diff options
Diffstat (limited to '')
-rw-r--r-- | dspam-exec.c | 2 | ||||
-rw-r--r-- | signature.c | 24 | ||||
-rw-r--r-- | signature.h | 8 |
3 files changed, 27 insertions, 7 deletions
diff --git a/dspam-exec.c b/dspam-exec.c index 65f33d0..0d02a24 100644 --- a/dspam-exec.c +++ b/dspam-exec.c @@ -185,7 +185,7 @@ int backend_handle_mail(struct mailbox_transaction_context *t, struct antispam_transaction_context *ast, struct mail *mail, bool from_spam) { - return signature_extract(t, mail, &ast->siglist, from_spam); + return signature_extract_to_list(t, mail, &ast->siglist, from_spam); } void backend_init(pool_t pool) diff --git a/signature.c b/signature.c index 228ff3f..1014ed3 100644 --- a/signature.c +++ b/signature.c @@ -14,9 +14,9 @@ void signature_init(void) debug("antispam: signature header line is \"%s\"\n", signature_hdr); } -int signature_extract(struct mailbox_transaction_context *t, - struct mail *mail, struct siglist **list, - bool from_spam) +int signature_extract_to_list(struct mailbox_transaction_context *t, + struct mail *mail, struct siglist **list, + bool from_spam) { const char *const *signatures; struct siglist *item; @@ -41,6 +41,24 @@ int signature_extract(struct mailbox_transaction_context *t, return 0; } +const char *signature_extract(struct mailbox_transaction_context *t, + struct mail *mail) +{ + const char *const *signatures; + + signatures = mail_get_headers(mail, signature_hdr); + if (!signatures || !signatures[0]) { + mail_storage_set_error(t->box->storage, + "antispam signature not found"); + return NULL; + } + + while (signatures[1]) + signatures++; + + return signatures[0]; +} + void signature_list_free(struct siglist **list) { struct siglist *item, *next; diff --git a/signature.h b/signature.h index a015fd3..9135aee 100644 --- a/signature.h +++ b/signature.h @@ -11,9 +11,11 @@ struct siglist { }; void signature_init(void); -int signature_extract(struct mailbox_transaction_context *t, - struct mail *mail, struct siglist **list, - bool from_spam); +int signature_extract_to_list(struct mailbox_transaction_context *t, + struct mail *mail, struct siglist **list, + bool from_spam); +const char *signature_extract(struct mailbox_transaction_context *t, + struct mail *mail); void signature_list_free(struct siglist **list); #endif /* _ANTISPAM_SIGNATURE_H */ |