Mercurial > dovecot > core-2.2
changeset 11917:1d3de1178b93
notify: Added support for mailbox_create
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 02 Aug 2010 15:32:39 +0100 |
parents | de24228a6a5b |
children | 59af5fd42221 |
files | src/plugins/notify/notify-plugin-private.h src/plugins/notify/notify-plugin.c src/plugins/notify/notify-plugin.h src/plugins/notify/notify-storage.c |
diffstat | 4 files changed, 27 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/notify/notify-plugin-private.h Mon Aug 02 15:30:27 2010 +0100 +++ b/src/plugins/notify/notify-plugin-private.h Mon Aug 02 15:32:39 2010 +0100 @@ -14,6 +14,7 @@ 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);
--- a/src/plugins/notify/notify-plugin.c Mon Aug 02 15:30:27 2010 +0100 +++ b/src/plugins/notify/notify-plugin.c Mon Aug 02 15:32:39 2010 +0100 @@ -147,6 +147,16 @@ } } +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;
--- a/src/plugins/notify/notify-plugin.h Mon Aug 02 15:30:27 2010 +0100 +++ b/src/plugins/notify/notify-plugin.h Mon Aug 02 15:32:39 2010 +0100 @@ -23,6 +23,7 @@ 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 @@ 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);
--- a/src/plugins/notify/notify-storage.c Mon Aug 02 15:30:27 2010 +0100 +++ b/src/plugins/notify/notify-storage.c Mon Aug 02 15:32:39 2010 +0100 @@ -189,6 +189,19 @@ } 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) { union mailbox_module_context *lbox = NOTIFY_CONTEXT(box); @@ -230,6 +243,7 @@ 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);