Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
c90e2692
...
c90e26920061473a5c5178e283b9a89cb61ca6c3
authored
2001-11-11 18:48:25 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Call run_user_action instead of dumping message contents to user's tty
1 parent
c42b6a2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
58 deletions
comsat/comsat.c
comsat/comsat.c
View file @
c90e269
...
...
@@ -17,15 +17,6 @@
#include "comsat.h"
#include <mailutils/mailbox.h>
#include <mailutils/message.h>
#include <mailutils/header.h>
#include <mailutils/body.h>
#include <mailutils/registrar.h>
#include <mailutils/stream.h>
#include <mailutils/mutil.h>
#include <mailutils/error.h>
#define IMPL "GNU Comsat Daemon"
#ifndef PATH_DEV
...
...
@@ -85,6 +76,7 @@ int port = 512; /* Default biff port */
int
timeout
=
0
;
int
maxlines
=
5
;
char
hostname
[
MAXHOSTNAMELEN
];
char
*
username
;
static
void
comsat_init
(
void
);
static
void
comsat_daemon_init
(
void
);
...
...
@@ -453,7 +445,6 @@ notify_user (char *user, char *device, char *path, off_t offset)
stream_t
stream
=
NULL
;
int
status
;
size_t
size
,
count
,
n
;
int
nlines
;
change_user
(
user
);
if
((
fp
=
fopen
(
device
,
"w"
))
==
NULL
)
...
...
@@ -464,9 +455,6 @@ notify_user (char *user, char *device, char *path, off_t offset)
cr
=
get_newline_str
(
fp
);
fprintf
(
fp
,
"%s
\a
New mail for %s@%s
\a
has arrived:%s----%s"
,
cr
,
user
,
hostname
,
cr
,
cr
);
if
(
!
path
)
{
path
=
mailbox_path
(
user
);
...
...
@@ -527,51 +515,7 @@ notify_user (char *user, char *device, char *path, off_t offset)
mailbox_messages_count
(
tmp
,
&
count
);
mailbox_get_message
(
tmp
,
1
,
&
msg
);
if
((
status
=
message_get_header
(
msg
,
&
header
)))
{
syslog
(
LOG_ERR
,
"can't get header: %s"
,
strerror
(
status
));
return
;
}
/* Take care to clear eighth bit, so we won't upset some stupid terminals */
#define LB(c) ((c)&0x7f)
nlines
=
maxlines
;
if
(
header_aget_value
(
header
,
MU_HEADER_FROM
,
&
p
)
==
0
)
{
fprintf
(
fp
,
"From: "
);
for
(;
*
p
;
p
++
)
fputc
(
LB
(
*
p
),
fp
);
fprintf
(
fp
,
cr
);
if
(
nlines
--
==
0
)
return
;
}
if
(
header_aget_value
(
header
,
MU_HEADER_SUBJECT
,
&
p
)
==
0
)
{
fprintf
(
fp
,
"Subject: "
);
for
(;
*
p
;
p
++
)
fputc
(
LB
(
*
p
),
fp
);
fprintf
(
fp
,
cr
);
if
(
nlines
--
==
0
)
return
;
}
message_get_body
(
msg
,
&
body
);
body_get_stream
(
body
,
&
stream
);
stream_read
(
stream
,
blurb
,
size
,
0
,
&
n
);
blurb
[
n
]
=
0
;
for
(
p
=
blurb
;
*
p
&&
nlines
--
>
0
;
)
{
while
(
*
p
&&
*
p
==
'\n'
)
p
++
;
for
(;
*
p
&&
*
p
!=
'\n'
;
p
++
)
fputc
(
LB
(
*
p
),
fp
);
fprintf
(
fp
,
cr
);
}
fprintf
(
fp
,
"----%s"
,
cr
);
run_user_action
(
fp
,
cr
,
msg
);
fclose
(
fp
);
}
...
...
@@ -655,6 +599,8 @@ change_user (char *user)
setgid
(
pw
->
pw_gid
);
setuid
(
pw
->
pw_uid
);
chdir
(
pw
->
pw_dir
);
username
=
user
;
}
void
...
...
Please
register
or
sign in
to post a comment