diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-10-01 14:17:23 +0200 |
---|---|---|
committer | Johannes Berg <johannes@sipsolutions.net> | 2007-10-01 14:17:23 +0200 |
commit | 74b2bd7184ad32939235be32452d3569bba67370 (patch) | |
tree | 24e2113b9599241793cb0ae38e7bc1fa2736aad4 /signature.c | |
parent | 40c43ecda62039059360b400dde4dc44edc67c3a (diff) | |
download | dovecot-antispam-74b2bd7184ad32939235be32452d3569bba67370.tar.gz dovecot-antispam-74b2bd7184ad32939235be32452d3569bba67370.tar.xz dovecot-antispam-74b2bd7184ad32939235be32452d3569bba67370.zip |
start box plugin experiment, seems not to work
Diffstat (limited to '')
-rw-r--r-- | signature.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/signature.c b/signature.c new file mode 100644 index 0000000..df04623 --- /dev/null +++ b/signature.c @@ -0,0 +1,53 @@ + +#include <stdlib.h> +#include "antispam-plugin.h" +#include "signature.h" +#include "mail-storage-private.h" + +static char *signature_hdr = "X-DSPAM-Signature"; + +void signature_init(void) +{ + char *tmp = getenv("ANTISPAM_SIGNATURE"); + if (tmp) + signature_hdr = tmp; + debug("antispam: signature header line is \"%s\"\n", signature_hdr); +} + +int signature_extract(struct mailbox_transaction_context *t, + struct mail *mail, struct siglist **list) +{ + const char *signature; + struct siglist *item; + + signature = mail_get_first_header(mail, signature_hdr); + if (!signature || !signature[0]) { + mail_storage_set_error(t->box->storage, + "antispam signature not found"); + return -1; + } + + item = i_new(struct siglist, 1); + item->next = *list; + *list = item; + item->sig = i_strdup(signature); + return 0; +} + +void signature_list_free(struct siglist **list) +{ + struct siglist *item, *next; + + i_assert(list); + + item = *list; + + while (item) { + next = item->next; + i_free(item->sig); + i_free(item); + item = next; + if (item) + next = item->next; + } +} |