From: Timo Sirainen Date: Mon, 2 Aug 2010 14:32:39 +0000 (+0100) Subject: notify: Added support for mailbox_create X-Git-Tag: 2.0.rc4~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=132bfe8fcb7a1be790dc8b5bf9d155c9f060808d;p=thirdparty%2Fdovecot%2Fcore.git notify: Added support for mailbox_create --- diff --git a/src/plugins/notify/notify-plugin-private.h b/src/plugins/notify/notify-plugin-private.h index 2e0043c1da..ecc5d974e1 100644 --- a/src/plugins/notify/notify-plugin-private.h +++ b/src/plugins/notify/notify-plugin-private.h @@ -14,6 +14,7 @@ void notify_contexts_mail_update_keywords(struct mail *mail, void notify_contexts_mail_transaction_commit(struct mailbox_transaction_context *t, struct mail_transaction_commit_changes *changes); void notify_contexts_mail_transaction_rollback(struct mailbox_transaction_context *t); +void notify_contexts_mailbox_create(struct mailbox *box); void notify_contexts_mailbox_delete_begin(struct mailbox *box); void notify_contexts_mailbox_delete_commit(struct mailbox *box); void notify_contexts_mailbox_delete_rollback(void); diff --git a/src/plugins/notify/notify-plugin.c b/src/plugins/notify/notify-plugin.c index 877af9bbf1..d3681c00f3 100644 --- a/src/plugins/notify/notify-plugin.c +++ b/src/plugins/notify/notify-plugin.c @@ -147,6 +147,16 @@ void notify_contexts_mail_transaction_rollback(struct mailbox_transaction_contex } } +void notify_contexts_mailbox_create(struct mailbox *box) +{ + struct notify_context *ctx; + + for (ctx = ctx_list; ctx != NULL; ctx = ctx->next) { + if (ctx->v.mailbox_create != NULL) + ctx->v.mailbox_create(box); + } +} + void notify_contexts_mailbox_delete_begin(struct mailbox *box) { struct notify_context *ctx; diff --git a/src/plugins/notify/notify-plugin.h b/src/plugins/notify/notify-plugin.h index db2fabfd76..4b6675f88f 100644 --- a/src/plugins/notify/notify-plugin.h +++ b/src/plugins/notify/notify-plugin.h @@ -23,6 +23,7 @@ struct notify_vfuncs { void (*mail_transaction_commit)(void *txn, struct mail_transaction_commit_changes *changes); void (*mail_transaction_rollback)(void *txn); + void (*mailbox_create)(struct mailbox *box); void *(*mailbox_delete_begin)(struct mailbox *box); void (*mailbox_delete_commit)(void *txn, struct mailbox *box); void (*mailbox_delete_rollback)(void *txn); @@ -30,6 +31,7 @@ struct notify_vfuncs { bool rename_children); }; +void notify_noop_mailbox_create(struct mailbox *box); struct notify_context * notify_register(const struct notify_vfuncs *vfuncs); void notify_unregister(struct notify_context *ctx); diff --git a/src/plugins/notify/notify-storage.c b/src/plugins/notify/notify-storage.c index 83913cb012..da1eade62d 100644 --- a/src/plugins/notify/notify-storage.c +++ b/src/plugins/notify/notify-storage.c @@ -188,6 +188,19 @@ notify_transaction_rollback(struct mailbox_transaction_context *t) lbox->super.transaction_rollback(t); } +static int +notify_mailbox_create(struct mailbox *box, const struct mailbox_update *update, + bool directory) +{ + union mailbox_module_context *lbox = NOTIFY_CONTEXT(box); + + if (lbox->super.create(box, update, directory) < 0) + return -1; + + notify_contexts_mailbox_create(box); + return 0; +} + static int notify_mailbox_delete(struct mailbox *box) { @@ -230,6 +243,7 @@ static void notify_mailbox_allocated(struct mailbox *box) v->transaction_begin = notify_transaction_begin; v->transaction_commit = notify_transaction_commit; v->transaction_rollback = notify_transaction_rollback; + v->create = notify_mailbox_create; v->delete = notify_mailbox_delete; v->rename = notify_mailbox_rename; MODULE_CONTEXT_SET_SELF(box, notify_storage_module, lbox);