]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
plugins: push-notification: Reformat push-notification-triggers.c.
authorStephan Bosch <stephan.bosch@open-xchange.com>
Sun, 1 Dec 2019 10:31:44 +0000 (11:31 +0100)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Thu, 6 Feb 2020 12:18:41 +0000 (12:18 +0000)
src/plugins/push-notification/push-notification-triggers.c

index 47cb2bd667178e4c8b7b87690716bc6f9e54219e..029ba53bf9dd6f20b0e4611f84a3b45ac00e4d71 100644 (file)
 #include "push-notification-txn-mbox.h"
 #include "push-notification-txn-msg.h"
 
-
 static void
-push_notification_trigger_mbox_common(struct push_notification_txn *txn,
-                                      struct mailbox *box,
-                                      struct push_notification_txn_mbox **mbox,
-                                      enum push_notification_event_trigger trigger)
+push_notification_trigger_mbox_common(
+       struct push_notification_txn *txn, struct mailbox *box,
+       struct push_notification_txn_mbox **mbox,
+       enum push_notification_event_trigger trigger)
 {
-    if (*mbox == NULL) {
-        *mbox = push_notification_txn_mbox_create(txn, box);
-    }
+       if (*mbox == NULL) {
+               *mbox = push_notification_txn_mbox_create(txn, box);
+       }
 
-    txn->trigger |= trigger;
+       txn->trigger |= trigger;
 }
 
-void
-push_notification_trigger_mbox_create(struct push_notification_txn *txn,
-                                      struct mailbox *box,
-                                      struct push_notification_txn_mbox *mbox)
+void push_notification_trigger_mbox_create(
+       struct push_notification_txn *txn, struct mailbox *box,
+       struct push_notification_txn_mbox *mbox)
 {
-    struct push_notification_event_config **ec;
-
-    push_notification_trigger_mbox_common(txn, box, &mbox,
-                                          PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_CREATE);
-
-    if (array_is_created(&txn->events)) {
-        array_foreach_modifiable(&txn->events, ec) {
-            if ((*ec)->event->mbox_triggers.create != NULL) {
-                (*ec)->event->mbox_triggers.create(txn, *ec, mbox);
-            }
-        }
-    }
+       struct push_notification_event_config **ec;
+
+       push_notification_trigger_mbox_common(
+               txn, box, &mbox, PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_CREATE);
+
+       if (array_is_created(&txn->events)) {
+               array_foreach_modifiable(&txn->events, ec) {
+                       if ((*ec)->event->mbox_triggers.create != NULL) {
+                               (*ec)->event->mbox_triggers.create(
+                                       txn, *ec, mbox);
+                       }
+               }
+       }
 }
 
-void
-push_notification_trigger_mbox_delete(struct push_notification_txn *txn,
-                                      struct mailbox *box,
-                                      struct push_notification_txn_mbox *mbox)
+void push_notification_trigger_mbox_delete(
+       struct push_notification_txn *txn, struct mailbox *box,
+       struct push_notification_txn_mbox *mbox)
 {
-    struct push_notification_event_config **ec;
-
-    push_notification_trigger_mbox_common(txn, box, &mbox,
-                                          PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_DELETE);
-
-    if (array_is_created(&txn->events)) {
-        array_foreach_modifiable(&txn->events, ec) {
-            if ((*ec)->event->mbox_triggers.delete != NULL) {
-                (*ec)->event->mbox_triggers.delete(txn, *ec, mbox);
-            }
-        }
-    }
+       struct push_notification_event_config **ec;
+
+       push_notification_trigger_mbox_common(
+               txn, box, &mbox, PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_DELETE);
+
+       if (array_is_created(&txn->events)) {
+               array_foreach_modifiable(&txn->events, ec) {
+                       if ((*ec)->event->mbox_triggers.delete != NULL) {
+                               (*ec)->event->mbox_triggers.delete(
+                                       txn, *ec, mbox);
+                       }
+               }
+       }
 }
 
-void
-push_notification_trigger_mbox_rename(struct push_notification_txn *txn,
-                                      struct mailbox *src,
-                                      struct mailbox *dest,
-                                      struct push_notification_txn_mbox *mbox)
+void push_notification_trigger_mbox_rename(
+       struct push_notification_txn *txn,
+       struct mailbox *src, struct mailbox *dest,
+       struct push_notification_txn_mbox *mbox)
 {
-    struct push_notification_event_config **ec;
-
-    push_notification_trigger_mbox_common(txn, dest, &mbox,
-                                          PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_RENAME);
-
-    if (array_is_created(&txn->events)) {
-        array_foreach_modifiable(&txn->events, ec) {
-            if ((*ec)->event->mbox_triggers.rename != NULL) {
-                (*ec)->event->mbox_triggers.rename(txn, *ec, mbox, src);
-            }
-        }
-    }
+       struct push_notification_event_config **ec;
+
+       push_notification_trigger_mbox_common(
+               txn, dest, &mbox, PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_RENAME);
+
+       if (array_is_created(&txn->events)) {
+               array_foreach_modifiable(&txn->events, ec) {
+                       if ((*ec)->event->mbox_triggers.rename != NULL) {
+                               (*ec)->event->mbox_triggers.rename(
+                                       txn, *ec, mbox, src);
+                       }
+               }
+       }
 }
 
-void
-push_notification_trigger_mbox_subscribe(struct push_notification_txn *txn,
-                                         struct mailbox *box,
-                                         bool subscribed,
-                                         struct push_notification_txn_mbox *mbox)
+void push_notification_trigger_mbox_subscribe(
+       struct push_notification_txn *txn, struct mailbox *box, bool subscribed,
+       struct push_notification_txn_mbox *mbox)
 {
-    struct push_notification_event_config **ec;
-
-    push_notification_trigger_mbox_common(txn, box, &mbox,
-                                          PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_SUBSCRIBE);
-
-    if (array_is_created(&txn->events)) {
-        array_foreach_modifiable(&txn->events, ec) {
-            if (subscribed == TRUE) {
-                if ((*ec)->event->mbox_triggers.subscribe != NULL) {
-                    (*ec)->event->mbox_triggers.subscribe(txn, *ec, mbox);
-                }
-            } else {
-                if ((*ec)->event->mbox_triggers.unsubscribe != NULL) {
-                    (*ec)->event->mbox_triggers.unsubscribe(txn, *ec, mbox);
-                }
-            }
-        }
-    }
+       struct push_notification_event_config **ec;
+
+       push_notification_trigger_mbox_common(
+               txn, box, &mbox,
+               PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_SUBSCRIBE);
+
+       if (array_is_created(&txn->events)) {
+               array_foreach_modifiable(&txn->events, ec) {
+                       if (subscribed == TRUE) {
+                               if ((*ec)->event->mbox_triggers.subscribe != NULL) {
+                                       (*ec)->event->mbox_triggers.subscribe(
+                                               txn, *ec, mbox);
+                               }
+                       } else {
+                               if ((*ec)->event->mbox_triggers.unsubscribe != NULL) {
+                                       (*ec)->event->mbox_triggers.unsubscribe(
+                                               txn, *ec, mbox);
+                               }
+                       }
+               }
+       }
 }
 
 static void
-push_notification_trigger_msg_common(struct push_notification_txn *txn,
-                                     struct mail *mail,
-                                     struct push_notification_txn_msg **msg,
-                                     enum push_notification_event_trigger trigger)
+push_notification_trigger_msg_common(
+       struct push_notification_txn *txn, struct mail *mail,
+       struct push_notification_txn_msg **msg,
+       enum push_notification_event_trigger trigger)
 {
-    if (*msg == NULL) {
-        *msg = push_notification_txn_msg_create(txn, mail);
-    }
+       if (*msg == NULL)
+               *msg = push_notification_txn_msg_create(txn, mail);
 
-    txn->trigger |= trigger;
+       txn->trigger |= trigger;
 }
 
-void
-push_notification_trigger_msg_save_new(struct push_notification_txn *txn,
-                                       struct mail *mail,
-                                       struct push_notification_txn_msg *msg)
+void push_notification_trigger_msg_save_new(
+       struct push_notification_txn *txn, struct mail *mail,
+       struct push_notification_txn_msg *msg)
 {
-    struct push_notification_event_config **ec;
-
-    push_notification_trigger_msg_common(txn, mail, &msg,
-                                         PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_NEW);
-
-    if (array_is_created(&txn->events)) {
-        array_foreach_modifiable(&txn->events, ec) {
-            if ((*ec)->event->msg_triggers.save != NULL) {
-                (*ec)->event->msg_triggers.save(txn, *ec, msg, mail);
-            }
-        }
-    }
+       struct push_notification_event_config **ec;
+
+       push_notification_trigger_msg_common(
+               txn, mail, &msg, PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_NEW);
+
+       if (array_is_created(&txn->events)) {
+               array_foreach_modifiable(&txn->events, ec) {
+                       if ((*ec)->event->msg_triggers.save != NULL) {
+                               (*ec)->event->msg_triggers.save(
+                                       txn, *ec, msg, mail);
+                       }
+               }
+       }
 }
 
-void
-push_notification_trigger_msg_save_append(struct push_notification_txn *txn,
-                                          struct mail *mail,
-                                          struct push_notification_txn_msg *msg)
+void push_notification_trigger_msg_save_append(
+       struct push_notification_txn *txn, struct mail *mail,
+       struct push_notification_txn_msg *msg)
 {
-    struct push_notification_event_config **ec;
-
-    push_notification_trigger_msg_common(txn, mail, &msg,
-                                         PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_APPEND);
-
-    if (array_is_created(&txn->events)) {
-        array_foreach_modifiable(&txn->events, ec) {
-            if ((*ec)->event->msg_triggers.append != NULL) {
-                (*ec)->event->msg_triggers.append(txn, *ec, msg, mail);
-            }
-        }
-    }
+       struct push_notification_event_config **ec;
+
+       push_notification_trigger_msg_common(
+               txn, mail, &msg,
+               PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_APPEND);
+
+       if (array_is_created(&txn->events)) {
+               array_foreach_modifiable(&txn->events, ec) {
+                       if ((*ec)->event->msg_triggers.append != NULL) {
+                               (*ec)->event->msg_triggers.append(
+                                       txn, *ec, msg, mail);
+                       }
+               }
+       }
 }
 
-void
-push_notification_trigger_msg_save_expunge(struct push_notification_txn *txn,
-                                           struct mail *mail,
-                                           struct push_notification_txn_msg *msg)
+void push_notification_trigger_msg_save_expunge(
+       struct push_notification_txn *txn, struct mail *mail,
+       struct push_notification_txn_msg *msg)
 {
-    struct push_notification_event_config **ec;
-
-    push_notification_trigger_msg_common(txn, mail, &msg,
-                                         PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_EXPUNGE);
-
-    if (array_is_created(&txn->events)) {
-        array_foreach_modifiable(&txn->events, ec) {
-            if ((*ec)->event->msg_triggers.expunge != NULL) {
-                (*ec)->event->msg_triggers.expunge(txn, *ec, msg);
-            }
-        }
-    }
+       struct push_notification_event_config **ec;
+
+       push_notification_trigger_msg_common(
+               txn, mail, &msg, PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_EXPUNGE);
+
+       if (array_is_created(&txn->events)) {
+               array_foreach_modifiable(&txn->events, ec) {
+                       if ((*ec)->event->msg_triggers.expunge != NULL) {
+                               (*ec)->event->msg_triggers.expunge(
+                                       txn, *ec, msg);
+                       }
+               }
+       }
 }
 
-void
-push_notification_trigger_msg_flag_change(struct push_notification_txn *txn,
-                                          struct mail *mail,
-                                          struct push_notification_txn_msg *msg,
-                                          enum mail_flags old_flags)
+void push_notification_trigger_msg_flag_change(
+       struct push_notification_txn *txn, struct mail *mail,
+       struct push_notification_txn_msg *msg, enum mail_flags old_flags)
 {
-    struct push_notification_event_config **ec;
-
-    push_notification_trigger_msg_common(txn, mail, &msg,
-                                         PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_FLAGCHANGE);
-
-    if (array_is_created(&txn->events)) {
-        array_foreach_modifiable(&txn->events, ec) {
-            if ((*ec)->event->msg_triggers.flagchange != NULL) {
-                (*ec)->event->msg_triggers.flagchange(txn, *ec, msg, mail,
-                                                      old_flags);
-            }
-        }
-    }
+       struct push_notification_event_config **ec;
+
+       push_notification_trigger_msg_common(
+               txn, mail, &msg,
+               PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_FLAGCHANGE);
+
+       if (array_is_created(&txn->events)) {
+               array_foreach_modifiable(&txn->events, ec) {
+                       if ((*ec)->event->msg_triggers.flagchange != NULL) {
+                               (*ec)->event->msg_triggers.flagchange(
+                                       txn, *ec, msg, mail, old_flags);
+                       }
+               }
+       }
 }
 
-void
-push_notification_trigger_msg_keyword_change(struct push_notification_txn *txn,
-                                             struct mail *mail,
-                                             struct push_notification_txn_msg *msg,
-                                             const char *const *old_keywords)
+void push_notification_trigger_msg_keyword_change(
+       struct push_notification_txn *txn, struct mail *mail,
+       struct push_notification_txn_msg *msg, const char *const *old_keywords)
 {
-    struct push_notification_event_config **ec;
-
-    push_notification_trigger_msg_common(txn, mail, &msg,
-                                         PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_KEYWORDCHANGE);
-
-    if (array_is_created(&txn->events)) {
-        array_foreach_modifiable(&txn->events, ec) {
-            if ((*ec)->event->msg_triggers.keywordchange != NULL) {
-                (*ec)->event->msg_triggers.keywordchange(txn, *ec, msg, mail,
-                                                         old_keywords);
-            }
-        }
-    }
+       struct push_notification_event_config **ec;
+
+       push_notification_trigger_msg_common(
+               txn, mail, &msg,
+               PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_KEYWORDCHANGE);
+
+       if (array_is_created(&txn->events)) {
+               array_foreach_modifiable(&txn->events, ec) {
+                       if ((*ec)->event->msg_triggers.keywordchange != NULL) {
+                               (*ec)->event->msg_triggers.keywordchange(
+                                       txn, *ec, msg, mail, old_keywords);
+                       }
+               }
+       }
 }