Mercurial > dovecot > original-hg > dovecot-1.2
changeset 4489:3d2be769d887 HEAD
Added hook_mailbox_opened to make it easier to hook all mailbox opens.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 11 Jul 2006 19:00:08 +0300 |
parents | 1489be4d7b26 |
children | 56d17f2e1d66 |
files | src/lib-storage/mail-storage-private.h src/lib-storage/mail-storage.c |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/mail-storage-private.h Tue Jul 11 18:59:33 2006 +0300 +++ b/src/lib-storage/mail-storage-private.h Tue Jul 11 19:00:08 2006 +0300 @@ -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);
--- a/src/lib-storage/mail-storage.c Tue Jul 11 18:59:33 2006 +0300 +++ b/src/lib-storage/mail-storage.c Tue Jul 11 19:00:08 2006 +0300 @@ -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)