dovecot: If Sieve plugin returns any errors, ignore them. Bounce...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jul 13 01:46:36 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/28836909b3b0
changeset: 5978:28836909b3b0
user: Timo Sirainen <tss at iki.fi>
date: Fri Jul 13 01:46:27 2007 +0300
description:
If Sieve plugin returns any errors, ignore them. Bounce the message only if
message couldn't be saved anywhere.
diffstat:
1 file changed, 15 insertions(+), 13 deletions(-)
src/deliver/deliver.c | 28 +++++++++++++++-------------
diffs (58 lines):
diff -r 38a73d870731 -r 28836909b3b0 src/deliver/deliver.c
--- a/src/deliver/deliver.c Fri Jul 13 00:18:24 2007 +0300
+++ b/src/deliver/deliver.c Fri Jul 13 01:46:27 2007 +0300
@@ -50,6 +50,7 @@ deliver_mail_func_t *deliver_mail = NULL
/* FIXME: these two should be in some context struct instead of as globals.. */
static const char *default_mailbox_name = NULL;
+static bool saved_mail = FALSE;
static bool tried_default_save = FALSE;
static bool no_mailbox_autocreate = FALSE;
@@ -155,9 +156,10 @@ int deliver_save(struct mail_namespace *
msgid = msgid == NULL ? "" : str_sanitize(msgid, 80);
mailbox_name = str_sanitize(mailbox_get_name(box), 80);
- if (ret == 0)
+ if (ret == 0) {
+ saved_mail = TRUE;
i_info("msgid=%s: saved mail to %s", msgid, mailbox_name);
- else {
+ } else {
enum mail_error error;
i_info("msgid=%s: save failed to %s: %s", msgid, mailbox_name,
@@ -753,22 +755,22 @@ int main(int argc, char *argv[])
i_fatal("mail_set_seq() failed");
default_mailbox_name = mailbox;
- ret = deliver_mail == NULL ? 0 :
- deliver_mail(ns, &storage, mail, destination, mailbox);
-
- if (ret == 0 || (ret < 0 && !tried_default_save)) {
+ if (deliver_mail != NULL)
+ (void)deliver_mail(ns, &storage, mail, destination, mailbox);
+
+ if (!saved_mail && !tried_default_save) {
/* plugins didn't handle this. save into the default mailbox. */
i_stream_seek(input, 0);
- ret = deliver_save(ns, &storage, mailbox, mail, 0, NULL);
- }
- if (ret < 0 && strcasecmp(mailbox, "INBOX") != 0) {
+ (void)deliver_save(ns, &storage, mailbox, mail, 0, NULL);
+ }
+ if (!saved_mail && strcasecmp(mailbox, "INBOX") != 0) {
/* still didn't work. try once more to save it
to INBOX. */
i_stream_seek(input, 0);
- ret = deliver_save(ns, &storage, "INBOX", mail, 0, NULL);
- }
-
- if (ret < 0) {
+ (void)deliver_save(ns, &storage, "INBOX", mail, 0, NULL);
+ }
+
+ if (!saved_mail) {
const char *error_string, *msgid;
enum mail_error error;
int ret;
More information about the dovecot-cvs
mailing list