bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_mbox_common(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz enum push_notification_event_trigger trigger)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz *mbox = push_notification_txn_mbox_create(txn, box);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_mbox_create(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_mbox_common(txn, box, &mbox,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_CREATE);
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 Slusarzpush_notification_trigger_mbox_delete(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_mbox_common(txn, box, &mbox,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_DELETE);
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 Slusarzpush_notification_trigger_mbox_rename(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_mbox_common(txn, dest, &mbox,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_RENAME);
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 Slusarzpush_notification_trigger_mbox_subscribe(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_mbox_common(txn, box, &mbox,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MBOX_SUBSCRIBE);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz array_foreach_modifiable(&txn->events, ec) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->mbox_triggers.subscribe != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->mbox_triggers.subscribe(txn, *ec, mbox);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->mbox_triggers.unsubscribe != NULL) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz (*ec)->event->mbox_triggers.unsubscribe(txn, *ec, mbox);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_msg_common(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz enum push_notification_event_trigger trigger)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz *msg = push_notification_txn_msg_create(txn, mail);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarzpush_notification_trigger_msg_save_new(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_msg_common(txn, mail, &msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_NEW);
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 Slusarzpush_notification_trigger_msg_save_append(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_msg_common(txn, mail, &msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_SAVE_APPEND);
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 Slusarzpush_notification_trigger_msg_save_expunge(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_msg_common(txn, mail, &msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_EXPUNGE);
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 Slusarzpush_notification_trigger_msg_flag_change(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_msg_common(txn, mail, &msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_FLAGCHANGE);
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 Slusarzpush_notification_trigger_msg_keyword_change(struct push_notification_txn *txn,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz const char *const *old_keywords)
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz struct push_notification_event_config **ec;
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz push_notification_trigger_msg_common(txn, mail, &msg,
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz PUSH_NOTIFICATION_EVENT_TRIGGER_MSG_KEYWORDCHANGE);
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz array_foreach_modifiable(&txn->events, ec) {
51ed197520dd9ea534fbc3bc1790ebe3cb5421e2Michael M Slusarz if ((*ec)->event->msg_triggers.keywordchange != NULL) {