bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "lib.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "array.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "mail-storage.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "push-notification-drivers.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "push-notification-events.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "push-notification-triggers.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "push-notification-txn-mbox.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz#include "push-notification-txn-msg.h"
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzstatic void
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_mbox_common(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mailbox *box,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_txn_mbox **mbox,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz enum push_notification_event_trigger trigger)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz{
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (*mbox == NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz *mbox = push_notification_txn_mbox_create(txn, box);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz txn->trigger |= trigger;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz}
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_mbox_create(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mailbox *box,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_txn_mbox *mbox)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz{
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_mbox_common(txn, box, &mbox,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_CREATE);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (array_is_created(&txn->events)) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz array_foreach_modifiable(&txn->events, ec) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->mbox_triggers.create != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->mbox_triggers.create(txn, *ec, mbox);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz}
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_mbox_delete(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mailbox *box,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_txn_mbox *mbox)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz{
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_mbox_common(txn, box, &mbox,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_DELETE);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (array_is_created(&txn->events)) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz array_foreach_modifiable(&txn->events, ec) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->mbox_triggers.delete != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->mbox_triggers.delete(txn, *ec, mbox);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz}
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_mbox_rename(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mailbox *src,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mailbox *dest,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_txn_mbox *mbox)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz{
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_mbox_common(txn, dest, &mbox,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_RENAME);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (array_is_created(&txn->events)) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz array_foreach_modifiable(&txn->events, ec) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->mbox_triggers.rename != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->mbox_triggers.rename(txn, *ec, mbox, src);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz}
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_mbox_subscribe(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mailbox *box,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz bool subscribed,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_txn_mbox *mbox)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz{
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_mbox_common(txn, box, &mbox,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_SUBSCRIBE);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (array_is_created(&txn->events)) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz array_foreach_modifiable(&txn->events, ec) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (subscribed == TRUE) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->mbox_triggers.subscribe != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->mbox_triggers.subscribe(txn, *ec, mbox);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz } else {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->mbox_triggers.unsubscribe != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->mbox_triggers.unsubscribe(txn, *ec, mbox);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz}
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzstatic void
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_msg_common(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mail *mail,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_txn_msg **msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz enum push_notification_event_trigger trigger)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz{
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (*msg == NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz *msg = push_notification_txn_msg_create(txn, mail);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz txn->trigger |= trigger;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz}
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_msg_save_new(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mail *mail,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_txn_msg *msg)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz{
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_msg_common(txn, mail, &msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_NEW);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (array_is_created(&txn->events)) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz array_foreach_modifiable(&txn->events, ec) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->msg_triggers.save != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->msg_triggers.save(txn, *ec, msg, mail);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz}
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_msg_save_append(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mail *mail,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_txn_msg *msg)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz{
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_msg_common(txn, mail, &msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_APPEND);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (array_is_created(&txn->events)) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz array_foreach_modifiable(&txn->events, ec) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->msg_triggers.append != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->msg_triggers.append(txn, *ec, msg, mail);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz}
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_msg_save_expunge(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mail *mail,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_txn_msg *msg)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz{
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_msg_common(txn, mail, &msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_EXPUNGE);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (array_is_created(&txn->events)) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz array_foreach_modifiable(&txn->events, ec) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->msg_triggers.expunge != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->msg_triggers.expunge(txn, *ec, msg);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz}
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_msg_flag_change(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mail *mail,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_txn_msg *msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz enum mail_flags old_flags)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz{
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_msg_common(txn, mail, &msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_FLAGCHANGE);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (array_is_created(&txn->events)) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz array_foreach_modifiable(&txn->events, ec) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->msg_triggers.flagchange != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->msg_triggers.flagchange(txn, *ec, msg, mail,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz old_flags);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz}
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzvoid
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_msg_keyword_change(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct mail *mail,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_txn_msg *msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz const char *const *old_keywords)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz{
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_msg_common(txn, mail, &msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_KEYWORDCHANGE);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if (array_is_created(&txn->events)) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz array_foreach_modifiable(&txn->events, ec) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->msg_triggers.keywordchange != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->msg_triggers.keywordchange(txn, *ec, msg, mail,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz old_keywords);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz }
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz}