dovecot-2.2: push-notification: Free all events at plugin deinit.

dovecot at dovecot.org dovecot at dovecot.org
Thu Oct 1 10:49:58 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/5f883bc3f380
changeset: 19268:5f883bc3f380
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Oct 01 13:48:24 2015 +0300
description:
push-notification: Free all events at plugin deinit.

diffstat:

 src/plugins/push-notification/push-notification-events-rfc5423.c |  36 ++++++---
 src/plugins/push-notification/push-notification-events-rfc5423.h |   1 +
 src/plugins/push-notification/push-notification-plugin.c         |   1 +
 3 files changed, 26 insertions(+), 12 deletions(-)

diffs (69 lines):

diff -r af0ae8ab2be4 -r 5f883bc3f380 src/plugins/push-notification/push-notification-events-rfc5423.c
--- a/src/plugins/push-notification/push-notification-events-rfc5423.c	Thu Oct 01 13:45:17 2015 +0300
+++ b/src/plugins/push-notification/push-notification-events-rfc5423.c	Thu Oct 01 13:48:24 2015 +0300
@@ -28,19 +28,31 @@
 extern struct push_notification_event push_notification_event_messageread;
 extern struct push_notification_event push_notification_event_messagetrash;
 
+static struct push_notification_event *rfc5423_events[] = {
+    &push_notification_event_flagsclear,
+    &push_notification_event_flagsset,
+    &push_notification_event_mailboxcreate,
+    &push_notification_event_mailboxdelete,
+    &push_notification_event_mailboxrename,
+    &push_notification_event_mailboxsubscribe,
+    &push_notification_event_mailboxunsubscribe,
+    &push_notification_event_messageappend,
+    &push_notification_event_messageexpunge,
+    &push_notification_event_messagenew,
+    &push_notification_event_messageread,
+    &push_notification_event_messagetrash
+};
 
 void push_notification_event_register_rfc5423_events(void)
 {
-    push_notification_event_register(&push_notification_event_flagsclear);
-    push_notification_event_register(&push_notification_event_flagsset);
-    push_notification_event_register(&push_notification_event_mailboxcreate);
-    push_notification_event_register(&push_notification_event_mailboxdelete);
-    push_notification_event_register(&push_notification_event_mailboxrename);
-    push_notification_event_register(&push_notification_event_mailboxsubscribe);
-    push_notification_event_register(&push_notification_event_mailboxunsubscribe);
-    push_notification_event_register(&push_notification_event_messageappend);
-    push_notification_event_register(&push_notification_event_messageexpunge);
-    push_notification_event_register(&push_notification_event_messagenew);
-    push_notification_event_register(&push_notification_event_messageread);
-    push_notification_event_register(&push_notification_event_messagetrash);
+    unsigned int i;
+    for (i = 0; i < N_ELEMENTS(rfc5423_events); i++)
+	push_notification_event_register(rfc5423_events[i]);
 }
+
+void push_notification_event_unregister_rfc5423_events(void)
+{
+    unsigned int i;
+    for (i = 0; i < N_ELEMENTS(rfc5423_events); i++)
+	push_notification_event_unregister(rfc5423_events[i]);
+}
diff -r af0ae8ab2be4 -r 5f883bc3f380 src/plugins/push-notification/push-notification-events-rfc5423.h
--- a/src/plugins/push-notification/push-notification-events-rfc5423.h	Thu Oct 01 13:45:17 2015 +0300
+++ b/src/plugins/push-notification/push-notification-events-rfc5423.h	Thu Oct 01 13:48:24 2015 +0300
@@ -5,6 +5,7 @@
 
 
 void push_notification_event_register_rfc5423_events(void);
+void push_notification_event_unregister_rfc5423_events(void);
 
 
 #endif	/* PUSH_NOTIFICATION_EVENTS_H */
diff -r af0ae8ab2be4 -r 5f883bc3f380 src/plugins/push-notification/push-notification-plugin.c
--- a/src/plugins/push-notification/push-notification-plugin.c	Thu Oct 01 13:45:17 2015 +0300
+++ b/src/plugins/push-notification/push-notification-plugin.c	Thu Oct 01 13:48:24 2015 +0300
@@ -348,6 +348,7 @@
     push_notification_driver_unregister(&push_notification_driver_dlog);
     push_notification_driver_unregister(&push_notification_driver_ox);
 
+    push_notification_event_unregister_rfc5423_events();
     mail_storage_hooks_remove(&push_notification_storage_hooks);
     notify_unregister(push_notification_ctx);
 }


More information about the dovecot-cvs mailing list