dovecot: If Sieve script didn't save the message anywhere, we sa...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jul 23 08:11:03 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/cd0f9be6f8ad
changeset: 6139:cd0f9be6f8ad
user: Timo Sirainen <tss at iki.fi>
date: Mon Jul 23 08:09:05 2007 +0300
description:
If Sieve script didn't save the message anywhere, we saved it to INBOX.
diffstat:
1 file changed, 22 insertions(+), 11 deletions(-)
src/deliver/deliver.c | 33 ++++++++++++++++++++++-----------
diffs (48 lines):
diff -r 447849dcc156 -r cd0f9be6f8ad src/deliver/deliver.c
--- a/src/deliver/deliver.c Mon Jul 23 04:45:35 2007 +0300
+++ b/src/deliver/deliver.c Mon Jul 23 08:09:05 2007 +0300
@@ -755,22 +755,33 @@ int main(int argc, char *argv[])
i_fatal("mail_set_seq() failed");
default_mailbox_name = mailbox;
- if (deliver_mail != NULL)
- (void)deliver_mail(ns, &storage, mail, destination, mailbox);
-
- if (!saved_mail && !tried_default_save) {
+ if (deliver_mail == NULL)
+ ret = -1;
+ else {
+ if (deliver_mail(ns, &storage, mail,
+ destination, mailbox) <= 0) {
+ /* if message was saved, don't bounce it even though
+ the script failed later. */
+ ret = saved_mail ? 0 : -1;
+ } else {
+ /* success. message may or may not have been saved. */
+ ret = 0;
+ }
+ }
+
+ if (ret < 0 && !tried_default_save) {
/* plugins didn't handle this. save into the default mailbox. */
i_stream_seek(input, 0);
- (void)deliver_save(ns, &storage, mailbox, mail, 0, NULL);
- }
- if (!saved_mail && strcasecmp(mailbox, "INBOX") != 0) {
+ ret = deliver_save(ns, &storage, mailbox, mail, 0, NULL);
+ }
+ if (ret < 0 && strcasecmp(mailbox, "INBOX") != 0) {
/* still didn't work. try once more to save it
to INBOX. */
i_stream_seek(input, 0);
- (void)deliver_save(ns, &storage, "INBOX", mail, 0, NULL);
- }
-
- if (!saved_mail) {
+ ret = deliver_save(ns, &storage, "INBOX", mail, 0, NULL);
+ }
+
+ if (ret < 0 ) {
const char *error_string, *msgid;
enum mail_error error;
int ret;
More information about the dovecot-cvs
mailing list