1 /* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
2 
3 #ifndef PUSH_NOTIFICATION_TRIGGERS_H
4 #define PUSH_NOTIFICATION_TRIGGERS_H
5 
6 #include "mail-types.h"
7 
8 struct mail;
9 struct mailbox;
10 struct push_notification_txn;
11 struct push_notification_txn_mbox;
12 struct push_notification_txn_msg;
13 
14 enum push_notification_event_trigger {
15 	PUSH_NOTIFICATION_EVENT_TRIGGER_NONE,
16 
17 	/* Mailbox actions */
18 	PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_CREATE	   = 0x001,
19 	PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_DELETE	   = 0x002,
20 	PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_RENAME	   = 0x004,
21 	PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_SUBSCRIBE	= 0x008,
22 
23 	/* Message actions */
24 	PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_NEW	  = 0x010,
25 	PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_APPEND   = 0x020,
26 	PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_EXPUNGE	   = 0x040,
27 	PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_FLAGCHANGE	= 0x080,
28 	PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_KEYWORDCHANGE = 0x100,
29 };
30 
31 /* Mailbox actions. */
32 void push_notification_trigger_mbox_create(
33 	struct push_notification_txn *txn, struct mailbox *box,
34 	struct push_notification_txn_mbox *mbox);
35 void push_notification_trigger_mbox_delete(
36 	struct push_notification_txn *txn, struct mailbox *box,
37 	struct push_notification_txn_mbox *mbox);
38 void push_notification_trigger_mbox_rename(
39 	struct push_notification_txn *txn,
40 	struct mailbox *src, struct mailbox *dest,
41 	struct push_notification_txn_mbox *mbox);
42 void push_notification_trigger_mbox_subscribe(
43 	struct push_notification_txn *txn, struct mailbox *box, bool subscribed,
44 	struct push_notification_txn_mbox *mbox);
45 
46 /* Message actions. */
47 void push_notification_trigger_msg_save_new(
48 	struct push_notification_txn *txn, struct mail *mail,
49 	struct push_notification_txn_msg *msg);
50 void push_notification_trigger_msg_save_append(
51 	struct push_notification_txn *txn, struct mail *mail,
52 	struct push_notification_txn_msg *msg);
53 void push_notification_trigger_msg_save_expunge(
54 	struct push_notification_txn *txn, struct mail *mail,
55 	struct push_notification_txn_msg *msg);
56 void push_notification_trigger_msg_flag_change(
57 	struct push_notification_txn *txn, struct mail *mail,
58 	struct push_notification_txn_msg *msg, enum mail_flags old_flags);
59 void push_notification_trigger_msg_keyword_change(
60 	struct push_notification_txn *txn, struct mail *mail,
61 	struct push_notification_txn_msg *msg, const char *const *old_keywords);
62 
63 #endif
64 
65