]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
push-notification: Make sure txn messages are unique
authorAki Tuomi <aki.tuomi@dovecot.fi>
Fri, 28 Sep 2018 10:01:58 +0000 (13:01 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 14 Nov 2018 12:01:53 +0000 (14:01 +0200)
save_count is not reliable as it's not incremented for events like
flag changes.

src/plugins/push-notification/push-notification-txn-msg.c

index 8d8c3e37c6d528ec5028041ae1d562360e6164f9..b8cb552bf6c8fac9877a96f62efcd08e9eee7341 100644 (file)
@@ -17,7 +17,7 @@ push_notification_txn_msg_create(struct push_notification_txn *txn,
 
     if (hash_table_is_created(txn->messages)) {
         msg = hash_table_lookup(txn->messages,
-                                POINTER_CAST(txn->t->save_count + 1));
+                                POINTER_CAST(mail->seq));
     } else {
         hash_table_create_direct(&txn->messages, txn->pool, 4);
     }
@@ -29,7 +29,7 @@ push_notification_txn_msg_create(struct push_notification_txn *txn,
         msg->seq = txn->t->save_count;
         msg->uid = mail->uid;
 
-        hash_table_insert(txn->messages, POINTER_CAST(txn->t->save_count + 1),
+        hash_table_insert(txn->messages, POINTER_CAST(mail->seq),
                           msg);
     }