]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
notify: Added support for mailbox_create
authorTimo Sirainen <tss@iki.fi>
Mon, 2 Aug 2010 14:32:39 +0000 (15:32 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 2 Aug 2010 14:32:39 +0000 (15:32 +0100)
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

index 2e0043c1da21f6890b73d49fe6c912cd9ffd6625..ecc5d974e11f396e7f4ff260a398e0dcb763b589 100644 (file)
@@ -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);
index 877af9bbf14e0933f87918f649b7dbab756a6171..d3681c00f3db5820e5d5b04f59a9ecdbdb59beff 100644 (file)
@@ -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;
index db2fabfd762bcd50ff53d2f9d451e6f5840f53ee..4b6675f88f02bd7507beaa33e4bd328adf816392 100644 (file)
@@ -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);
index 83913cb012287c2f9ca04a0670dd71bd38ff45ff..da1eade62d2bd07ec825a3336aa720dfa3482607 100644 (file)
@@ -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);