[dovecot-cvs] dovecot/src/lib-storage mail-storage-private.h, 1.32, 1.33 mail-storage.c, 1.56, 1.57

cras at dovecot.org cras at dovecot.org
Tue Jul 11 19:00:24 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-storage
In directory talvi:/tmp/cvs-serv9293

Modified Files:
	mail-storage-private.h mail-storage.c 
Log Message:
Added hook_mailbox_opened to make it easier to hook all mailbox opens.



Index: mail-storage-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage-private.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- mail-storage-private.h	29 Jun 2006 11:08:50 -0000	1.32
+++ mail-storage-private.h	11 Jul 2006 16:00:08 -0000	1.33
@@ -8,6 +8,9 @@
 #define MAIL_STORAGE_ERR_MAILBOX_NOT_FOUND "Mailbox doesn't exist: %s"
 #define MAIL_STORAGE_ERR_NO_PERMISSION "Permission denied"
 
+/* Called after mailbox has been opened */
+extern void (*hook_mailbox_opened)(struct mailbox *box);
+
 struct mail_storage_vfuncs {
 	void (*class_init)(void);
 	void (*class_deinit)(void);

Index: mail-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- mail-storage.c	28 Jun 2006 16:31:06 -0000	1.56
+++ mail-storage.c	11 Jul 2006 16:00:08 -0000	1.57
@@ -27,6 +27,8 @@
 unsigned int mail_storage_module_id = 0;
 unsigned int mail_storage_mail_index_module_id = 0;
 
+void (*hook_mailbox_opened)(struct mailbox *box) = NULL;
+
 static ARRAY_DEFINE(storages, struct mail_storage *);
 
 void mail_storage_init(void)
@@ -366,7 +368,12 @@
 			     struct istream *input,
 			     enum mailbox_open_flags flags)
 {
-	return storage->v.mailbox_open(storage, name, input, flags);
+	struct mailbox *box;
+
+	box = storage->v.mailbox_open(storage, name, input, flags);
+	if (hook_mailbox_opened != NULL && box != NULL)
+		hook_mailbox_opened(box);
+	return box;
 }
 
 int mailbox_close(struct mailbox **_box)



More information about the dovecot-cvs mailing list