Mercurial > dovecot > original-hg > dovecot-1.2
diff src/plugins/trash/trash-plugin.c @ 6024:6074e9e6059d HEAD
Added debug logging.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 15 Jul 2007 22:30:14 +0300 |
parents | 1fd9616157e4 |
children | 6c0bfc35af03 |
line wrap: on
line diff
--- a/src/plugins/trash/trash-plugin.c Sun Jul 15 15:30:00 2007 +0300 +++ b/src/plugins/trash/trash-plugin.c Sun Jul 15 22:30:14 2007 +0300 @@ -188,8 +188,15 @@ mailbox_close(&trash->box); } - if (size_expunged < size_needed) + if (size_expunged < size_needed) { + if (getenv("DEBUG") != NULL) { + i_info("trash plugin: Failed to remove enough messages " + "(needed %llu bytes, expunged only %llu bytes)", + (unsigned long long)size_needed, + (unsigned long long)size_expunged); + } return FALSE; + } ctx->bytes_used = ctx->bytes_used > (int64_t)size_expunged ? ctx->bytes_used - size_expunged : 0; @@ -206,8 +213,13 @@ for (i = 0; ; i++) { ret = trash_next_quota_test_alloc(ctx, size, too_large_r); - if (ret != 0 || *too_large_r) + if (ret != 0 || *too_large_r) { + if (getenv("DEBUG") != NULL && *too_large_r) { + i_info("trash plugin: Mail is larger than " + "quota, won't even try to handle"); + } return ret; + } if (i == MAX_RETRY_COUNT) { /* trash_try_clean_mails() should have returned 0 if @@ -261,6 +273,11 @@ trash->name = p_strdup(config_pool, name+1); trash->priority = atoi(t_strdup_until(line, name)); trash->search_arg.type = SEARCH_ALL; + + if (getenv("DEBUG") != NULL) { + i_info("trash plugin: Added '%s' with priority %d", + trash->name, trash->priority); + } } i_stream_destroy(&input); (void)close(fd); @@ -275,8 +292,11 @@ const char *env; env = getenv("TRASH"); - if (env == NULL) + if (env == NULL) { + if (getenv("DEBUG") != NULL) + i_info("trash plugin: No trash setting, disabled"); return; + } if (quota_set == NULL) { i_error("trash plugin: quota plugin not initialized");