Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6536:2a2fd5c3b42e HEAD
Log mailbox renames also.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 06 Oct 2007 03:08:48 +0300 |
parents | d4d6457550b5 |
children | 58d9f94b9919 |
files | dovecot-example.conf src/plugins/mail-log/mail-log-plugin.c |
diffstat | 2 files changed, 21 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/dovecot-example.conf Sat Oct 06 03:05:37 2007 +0300 +++ b/dovecot-example.conf Sat Oct 06 03:08:48 2007 +0300 @@ -1119,7 +1119,7 @@ #lazy_expunge = .EXPUNGED/ .DELETED/ .DELETED/.EXPUNGED/ # Events to log. Default is all. - #mail_log_events = delete undelete expunge copy mailbox_delete + #mail_log_events = delete undelete expunge copy mailbox_delete mailbox_rename # Group events within a transaction to one line. #mail_log_group_events = # Available fields: uid, box, msgid, size, vsize
--- a/src/plugins/mail-log/mail-log-plugin.c Sat Oct 06 03:05:37 2007 +0300 +++ b/src/plugins/mail-log/mail-log-plugin.c Sat Oct 06 03:08:48 2007 +0300 @@ -37,6 +37,7 @@ MAIL_LOG_EVENT_EXPUNGE = 0x04, MAIL_LOG_EVENT_COPY = 0x08, MAIL_LOG_EVENT_MAILBOX_DELETE = 0x10, + MAIL_LOG_EVENT_MAILBOX_RENAME = 0x20, MAIL_LOG_EVENT_MASK_ALL = 0x1f }; @@ -471,6 +472,24 @@ return 0; } +static int +mail_log_mailbox_list_rename(struct mailbox_list *list, const char *oldname, + const char *newname) +{ + union mailbox_list_module_context *llist = MAIL_LOG_LIST_CONTEXT(list); + + if (llist->super.rename_mailbox(list, oldname, newname) < 0) + return -1; + + if ((mail_log_set.events & MAIL_LOG_EVENT_MAILBOX_RENAME) == 0) + return 0; + + i_info("Mailbox renamed: %s -> %s", + str_sanitize(oldname, MAILBOX_NAME_LOG_LEN), + str_sanitize(newname, MAILBOX_NAME_LOG_LEN)); + return 0; +} + static void mail_log_mail_storage_created(struct mail_storage *storage) { union mail_storage_module_context *lstorage; @@ -495,6 +514,7 @@ llist = p_new(list->pool, union mailbox_list_module_context, 1); llist->super = list->v; list->v.delete_mailbox = mail_log_mailbox_list_delete; + list->v.rename_mailbox = mail_log_mailbox_list_rename; MODULE_CONTEXT_SET_SELF(list, mail_log_mailbox_list_module, llist); }