dovecot-1.2: expire plugin: If mail_debug=yes, log more debug in...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jul 8 06:35:15 EEST 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/df2d4e398c06
changeset: 9210:df2d4e398c06
user: Timo Sirainen <tss at iki.fi>
date: Tue Jul 07 23:35:04 2009 -0400
description:
expire plugin: If mail_debug=yes, log more debug information.
diffstat:
1 file changed, 21 insertions(+), 11 deletions(-)
src/plugins/expire/expire-plugin.c | 32 +++++++++++++++++++++-----------
diffs (63 lines):
diff -r 76cff789dae2 -r df2d4e398c06 src/plugins/expire/expire-plugin.c
--- 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 @@ struct expire_transaction_context {
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 @@ expire_mailbox_open(struct mail_storage
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);
-
- secs = expire_box_find_min_secs(expire.env, str_c(vname),
- &altmove);
- if (secs != 0)
- mailbox_expire_hook(box, secs, altmove);
- }
+ 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 (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 @@ void expire_plugin_init(void)
{
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 @@ void expire_plugin_init(void)
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");
}
More information about the dovecot-cvs
mailing list