diff -r 5ebc6aae4d7c src/mailbox.c --- a/src/mailbox.c Mon Apr 29 14:59:26 2013 +0200 +++ b/src/mailbox.c Mon Aug 05 11:24:45 2013 +0200 @@ -3,6 +3,7 @@ #include "user.h" #include "mailbox.h" #include "backends.h" +#include "str-sanitize.h" static MODULE_CONTEXT_DEFINE_INIT(antispam_storage_module, &mail_storage_module_register); @@ -10,6 +11,7 @@ &mail_storage_module_register); #define TRANSACTION_CONTEXT(obj) MODULE_CONTEXT(obj, antispam_transaction_module) +#define MAILBOX_NAME_LOG_LEN 64 struct antispam_transaction { @@ -27,7 +29,7 @@ static enum mailbox_class antispam_mailbox_classify(struct mailbox *box) { - const char *name = mailbox_get_name(box); + const char *name = mailbox_get_vname(box); struct antispam_user *asu = USER_CONTEXT(box->storage->user); enum match_type i; char **iter; @@ -107,22 +109,35 @@ enum mailbox_copy_type copy_type = antispam_classify_copy(asms->box_class, asmb->box_class); +#define LOG_COPYTYPE(ct) \ + i_info("antispam: copytype for '%s' -> '%s' is %s", \ + str_sanitize(mailbox_get_vname(mail->box), MAILBOX_NAME_LOG_LEN), \ + str_sanitize(mailbox_get_vname(t->box), MAILBOX_NAME_LOG_LEN), \ + (ct)); + switch (copy_type) { case MCT_HAM: + LOG_COPYTYPE("HAM"); + /* will continue processing further in this function */ + break; case MCT_SPAM: + LOG_COPYTYPE("SPAM"); /* will continue processing further in this function */ break; case MCT_IGNORE: + LOG_COPYTYPE("IGNORE"); return asmb->module_ctx.super.copy(ctx, mail); break; case MCT_DENY: + LOG_COPYTYPE("DENY"); mail_storage_set_error(t->box->storage, MAIL_ERROR_NOTPOSSIBLE, "This type of copy is forbidden"); return -1; break; } +#undef LOG_COPYTYPE if (asmb->module_ctx.super.copy(ctx, mail) != 0) return -1;