diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2002-11-20 12:33:30 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2002-11-20 12:33:30 +0000 |
commit | 6f7e5734c0e184d80ff4dc5009368120ad93d29a (patch) | |
tree | a2637d616cf1384b41d12acc0db66dd7009b209f /mail.local | |
parent | e2ab88fe48b6a715d3c4768e1dc353bc23e753e4 (diff) | |
download | mailutils-6f7e5734c0e184d80ff4dc5009368120ad93d29a.tar.gz mailutils-6f7e5734c0e184d80ff4dc5009368120ad93d29a.tar.bz2 |
(mda): Changed prototype.
(struct mda_data): Replaced FILE *fp with message_t msg.
Diffstat (limited to 'mail.local')
-rw-r--r-- | mail.local/mail.local.h | 6 | ||||
-rw-r--r-- | mail.local/script.c | 30 |
2 files changed, 8 insertions, 28 deletions
diff --git a/mail.local/mail.local.h b/mail.local/mail.local.h index eb1cde76e..79203b0f2 100644 --- a/mail.local/mail.local.h +++ b/mail.local/mail.local.h @@ -102,18 +102,18 @@ extern int exit_code; extern void setgroupquota __P((char *str)); extern int check_quota __P((char *name, size_t size, size_t *rest)); -int mda __P((FILE *fp, char *username)); +int mda __P((message_t msg, char *username)); int switch_user_id __P((struct mu_auth_data *auth, int user)); void mailer_err __P((char *fmt, ...)); #ifdef WITH_GUILE struct mda_data { - FILE *fp; + message_t msg; + char *tempfile; char *progfile; char *progfile_pattern; char **argv; - char *tempfile; }; int prog_mda (struct mda_data *data); diff --git a/mail.local/script.c b/mail.local/script.c index 621861bef..081d395a8 100644 --- a/mail.local/script.c +++ b/mail.local/script.c @@ -34,11 +34,13 @@ prog_mda (struct mda_data *data) char *x_argv[2]; guimb_param_t param; mailbox_t mbox; - + stream_t stream = NULL; + x_argv[0] = "mail.local"; x_argv[1] = NULL; - fflush (data->fp); + message_get_stream (data->msg, &stream); + stream_flush (stream); if (mailbox_create (&mbox, data->tempfile) || mailbox_open (mbox, MU_STREAM_RDWR) != 0) { @@ -97,7 +99,6 @@ mda_catch_body (void *data, mailbox_t mbox) struct mda_data *md = data; message_t mesg = NULL; attribute_t attr = NULL; - FILE *fp = md->fp; if (access (md->progfile, R_OK)) { @@ -115,29 +116,8 @@ mda_catch_body (void *data, mailbox_t mbox) if (attribute_is_deleted (attr)) return SCM_BOOL_F; - if (message_is_modified (mesg)) - { - char *tname; - int fd = mu_tempfile (NULL, &tname); - mailbox_t tmp; - - close (fd); - if (mailbox_create (&tmp, tname) == 0 - && mailbox_open (tmp, MU_STREAM_RDWR) == 0) - { - mailbox_append_message (tmp, mesg); - mailbox_close (tmp); - mailbox_destroy (&tmp); - - fp = fopen (tname, "r"); - } - unlink (tname); - } - mda_switch_to_user (NULL); - mda (fp, md->argv[0]); - if (fp != md->fp) - fclose (fp); + mda (md->msg, md->argv[0]); return SCM_BOOL_F; } |