dovecot-2.0: notify: Added support for mailbox_create

dovecot at dovecot.org dovecot at dovecot.org
Mon Aug 2 17:33:03 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/1d3de1178b93
changeset: 11917:1d3de1178b93
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Aug 02 15:32:39 2010 +0100
description:
notify: Added support for mailbox_create

diffstat:

 src/plugins/notify/notify-plugin-private.h |   1 +
 src/plugins/notify/notify-plugin.c         |  10 ++++++++++
 src/plugins/notify/notify-plugin.h         |   2 ++
 src/plugins/notify/notify-storage.c        |  14 ++++++++++++++
 4 files changed, 27 insertions(+), 0 deletions(-)

diffs (81 lines):

diff -r de24228a6a5b -r 1d3de1178b93 src/plugins/notify/notify-plugin-private.h
--- 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);
diff -r de24228a6a5b -r 1d3de1178b93 src/plugins/notify/notify-plugin.c
--- 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;
diff -r de24228a6a5b -r 1d3de1178b93 src/plugins/notify/notify-plugin.h
--- 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);
diff -r de24228a6a5b -r 1d3de1178b93 src/plugins/notify/notify-storage.c
--- 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);


More information about the dovecot-cvs mailing list