dovecot: Log mailbox renames also.
dovecot at dovecot.org
dovecot at dovecot.org
Sat Oct 6 03:08:52 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/2a2fd5c3b42e
changeset: 6536:2a2fd5c3b42e
user: Timo Sirainen <tss at iki.fi>
date: Sat Oct 06 03:08:48 2007 +0300
description:
Log mailbox renames also.
diffstat:
2 files changed, 21 insertions(+), 1 deletion(-)
dovecot-example.conf | 2 +-
src/plugins/mail-log/mail-log-plugin.c | 20 ++++++++++++++++++++
diffs (56 lines):
diff -r d4d6457550b5 -r 2a2fd5c3b42e dovecot-example.conf
--- 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 @@ plugin {
#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
diff -r d4d6457550b5 -r 2a2fd5c3b42e src/plugins/mail-log/mail-log-plugin.c
--- 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 @@ enum mail_log_event {
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 @@ mail_log_mailbox_list_delete(struct mail
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 @@ static void mail_log_mailbox_list_create
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);
}
More information about the dovecot-cvs
mailing list