Mercurial > dovecot > core-2.2
changeset 19268:5f883bc3f380
push-notification: Free all events at plugin deinit.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 01 Oct 2015 13:48:24 +0300 |
parents | af0ae8ab2be4 |
children | cb7b0ad2836a |
files | src/plugins/push-notification/push-notification-events-rfc5423.c src/plugins/push-notification/push-notification-events-rfc5423.h src/plugins/push-notification/push-notification-plugin.c |
diffstat | 3 files changed, 26 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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]); +}
--- 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 */
--- 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); }