From: Michael Slusarz Date: Wed, 30 Sep 2015 23:43:20 +0000 (-0600) Subject: push-notification: Fix distinguishing between IMAP APPEND and MTA deliveries X-Git-Tag: 2.2.19~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ee5a85e75d520497bd43dbfcc6fc273f3e57cea;p=thirdparty%2Fdovecot%2Fcore.git push-notification: Fix distinguishing between IMAP APPEND and MTA deliveries --- diff --git a/src/plugins/push-notification/push-notification-plugin.c b/src/plugins/push-notification/push-notification-plugin.c index 6d2fd92db9..0d065c3a39 100644 --- a/src/plugins/push-notification/push-notification-plugin.c +++ b/src/plugins/push-notification/push-notification-plugin.c @@ -141,13 +141,13 @@ static void push_notification_mailbox_subscribe(struct mailbox *box, static void push_notification_mail_save(void *txn, struct mail *mail) { - struct push_notification_txn *ptxn = (struct push_notification_txn *)txn; + struct push_notification_txn *ptxn = txn; - /* External means a COPY or APPEND IMAP action. */ - if (ptxn->t->flags & MAILBOX_TRANSACTION_FLAG_EXTERNAL) { - push_notification_trigger_msg_save_append(ptxn, mail, NULL); - } else { + /* POST_SESSION means MTA delivery. */ + if (mail->box->flags & MAILBOX_FLAG_POST_SESSION) { push_notification_trigger_msg_save_new(ptxn, mail, NULL); + } else { + push_notification_trigger_msg_save_append(ptxn, mail, NULL); } } @@ -155,8 +155,7 @@ static void push_notification_mail_copy(void *txn, struct mail *src ATTR_UNUSED, struct mail *dest) { - push_notification_trigger_msg_save_append( - (struct push_notification_txn *)txn, dest, NULL); + push_notification_mail_save(txn, dest); } static void push_notification_mail_expunge(void *txn, struct mail *mail)