1 /* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
2 
3 #include "lib.h"
4 
5 #include "push-notification-events.h"
6 #include "push-notification-events-rfc5423.h"
7 
8 /* These are the RFC 5423 Mail Store Events currently handled within the core
9    push-notification code.
10 
11    @todo: These events are not currently handled:
12      - Login
13      - Logout
14      - QuotaExceed
15      - Quota Within
16  */
17 extern struct push_notification_event push_notification_event_flagsclear;
18 extern struct push_notification_event push_notification_event_flagsset;
19 extern struct push_notification_event push_notification_event_mailboxcreate;
20 extern struct push_notification_event push_notification_event_mailboxdelete;
21 extern struct push_notification_event push_notification_event_mailboxrename;
22 extern struct push_notification_event push_notification_event_mailboxsubscribe;
23 extern struct push_notification_event push_notification_event_mailboxunsubscribe;
24 extern struct push_notification_event push_notification_event_messageappend;
25 extern struct push_notification_event push_notification_event_messageexpunge;
26 extern struct push_notification_event push_notification_event_messagenew;
27 extern struct push_notification_event push_notification_event_messageread;
28 extern struct push_notification_event push_notification_event_messagetrash;
29 
30 static struct push_notification_event *rfc5423_events[] = {
31 	&push_notification_event_flagsclear,
32 	&push_notification_event_flagsset,
33 	&push_notification_event_mailboxcreate,
34 	&push_notification_event_mailboxdelete,
35 	&push_notification_event_mailboxrename,
36 	&push_notification_event_mailboxsubscribe,
37 	&push_notification_event_mailboxunsubscribe,
38 	&push_notification_event_messageappend,
39 	&push_notification_event_messageexpunge,
40 	&push_notification_event_messagenew,
41 	&push_notification_event_messageread,
42 	&push_notification_event_messagetrash
43 };
44 
push_notification_event_register_rfc5423_events(void)45 void push_notification_event_register_rfc5423_events(void)
46 {
47 	unsigned int i;
48 
49 	for (i = 0; i < N_ELEMENTS(rfc5423_events); i++)
50 		push_notification_event_register(rfc5423_events[i]);
51 }
52 
push_notification_event_unregister_rfc5423_events(void)53 void push_notification_event_unregister_rfc5423_events(void)
54 {
55 	unsigned int i;
56 
57 	for (i = 0; i < N_ELEMENTS(rfc5423_events); i++)
58 		push_notification_event_unregister(rfc5423_events[i]);
59 }
60