Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9210:df2d4e398c06 HEAD
expire plugin: If mail_debug=yes, log more debug information.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 07 Jul 2009 23:35:04 -0400 |
parents | 76cff789dae2 |
children | 219ee9858156 |
files | src/plugins/expire/expire-plugin.c |
diffstat | 1 files changed, 19 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/expire/expire-plugin.c Tue Jul 07 23:30:51 2009 -0400 +++ b/src/plugins/expire/expire-plugin.c Tue Jul 07 23:35:04 2009 -0400 @@ -40,6 +40,7 @@ const char *expire_plugin_version = PACKAGE_VERSION; +static bool expire_debug; static struct expire expire; static MODULE_CONTEXT_DEFINE_INIT(expire_storage_module, &mail_storage_module_register); @@ -260,15 +261,24 @@ bool altmove; box = xpr_storage->super.mailbox_open(storage, name, input, flags); - if (box != NULL) { - vname = t_str_new(128); - (void)mail_namespace_get_vname(storage->ns, vname, name); + if (box == NULL) + return NULL; + + vname = t_str_new(128); + (void)mail_namespace_get_vname(storage->ns, vname, name); - secs = expire_box_find_min_secs(expire.env, str_c(vname), - &altmove); - if (secs != 0) - mailbox_expire_hook(box, secs, altmove); + secs = expire_box_find_min_secs(expire.env, str_c(vname), &altmove); + if (expire_debug) { + if (secs == 0) { + i_info("expire: No expiring in mailbox: %s", + str_c(vname)); + } else { + i_info("expire: Mails expire in %u secs in mailbox: %s", + secs, str_c(vname)); + } } + if (secs != 0) + mailbox_expire_hook(box, secs, altmove); return box; } @@ -291,6 +301,7 @@ { const char *expunge_env, *altmove_env, *dict_uri, *base_dir; + expire_debug = getenv("DEBUG") != NULL; expunge_env = getenv("EXPIRE"); altmove_env = getenv("EXPIRE_ALTMOVE"); if (expunge_env != NULL || altmove_env != NULL) { @@ -312,8 +323,7 @@ expire.next_hook_mail_storage_created = hook_mail_storage_created; hook_mail_storage_created = expire_mail_storage_created; - } else if (getenv("DEBUG") != NULL && - getenv("EXPIRE_TOOL_BINARY") == NULL) { + } else if (expire_debug && getenv("EXPIRE_TOOL_BINARY") == NULL) { i_info("expire: No expire or expire_altmove settings - " "plugin disabled"); }