]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
push-notification: Add event to push notification transaction
authorAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 15 Oct 2018 09:03:58 +0000 (12:03 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 14 Nov 2018 12:14:02 +0000 (14:14 +0200)
src/plugins/push-notification/push-notification-drivers.h
src/plugins/push-notification/push-notification-plugin.c

index 0bd4f283c9f0becda93b3dfbe85c6e9ea8698054..26e5f343ce79c5859540b2cf2cafaa86e1ae1505 100644 (file)
@@ -95,6 +95,8 @@ struct push_notification_txn {
     ARRAY(struct push_notification_driver_txn *) drivers;
     ARRAY(struct push_notification_event_config *) events;
 
+    struct event *event;
+
     /* Used with mailbox events. */
     struct push_notification_txn_mbox *mbox_txn;
 
index e867af2e0de5c06474fc23d29ee041e2e5792c1b..37ad32d0278256753929fb558d4de206eb726761 100644 (file)
@@ -81,7 +81,9 @@ push_notification_transaction_create(struct mailbox *box,
     ptxn->puser = PUSH_NOTIFICATION_USER_CONTEXT(ptxn->muser);
     ptxn->t = t;
     ptxn->trigger = PUSH_NOTIFICATION_EVENT_TRIGGER_NONE;
-
+    ptxn->event = event_create(ptxn->muser->event);
+    event_add_category(ptxn->event, &event_category_push_notification);
+    event_set_append_log_prefix(ptxn->event, "push-notification: ");
     p_array_init(&ptxn->drivers, pool, 4);
 
     return ptxn;
@@ -100,6 +102,7 @@ static void push_notification_transaction_end
         }
     }
 
+    event_unref(&ptxn->event);
     pool_unref(&ptxn->pool);
 }