aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--antispam-plugin.h15
-rw-r--r--signature.c14
2 files changed, 17 insertions, 12 deletions
diff --git a/antispam-plugin.h b/antispam-plugin.h
index dfe4445..d50abf5 100644
--- a/antispam-plugin.h
+++ b/antispam-plugin.h
@@ -93,6 +93,15 @@ static inline struct istream *get_mail_stream(struct mail *mail)
return result;
}
+static inline const char *const *
+get_mail_headers(struct mail *mail, const char *hdr)
+{
+ const char *const *result;
+ if (mail_get_headers(mail, hdr, &result) < 0)
+ return NULL;
+ return result;
+}
+
static inline struct ostream *
o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
{
@@ -109,6 +118,12 @@ static inline struct istream *get_mail_stream(struct mail *mail)
return mail_get_stream(mail, NULL, NULL);
}
+static inline const char *const *
+get_mail_headers(struct mail *mail, const char *hdr)
+{
+ return mail_get_headers(mail, hdr);
+}
+
static inline struct ostream *
o_stream_create_from_fd(int fd, pool_t pool)
{
diff --git a/signature.c b/signature.c
index bf257ea..7f9d83b 100644
--- a/signature.c
+++ b/signature.c
@@ -21,12 +21,7 @@ int signature_extract_to_list(struct mailbox_transaction_context *t,
const char *const *signatures;
struct siglist *item;
-#ifdef CONFIG_DOVECOT_11
- if (mail_get_headers(mail, signature_hdr, &signatures) < 0)
- signatures = NULL;
-#else
- signatures = mail_get_headers(mail, signature_hdr);
-#endif
+ signatures = get_mail_headers(mail, signature_hdr);
if (!signatures || !signatures[0]) {
mail_storage_set_error(t->box->storage,
ME(NOTPOSSIBLE)
@@ -52,12 +47,7 @@ const char *signature_extract(struct mailbox_transaction_context *t,
{
const char *const *signatures;
-#ifdef CONFIG_DOVECOT_11
- if (mail_get_headers(mail, signature_hdr, &signatures) < 0)
- signatures = NULL;
-#else
- signatures = mail_get_headers(mail, signature_hdr);
-#endif
+ signatures = get_mail_headers(mail, signature_hdr);
if (!signatures || !signatures[0]) {
mail_storage_set_error(t->box->storage,
ME(NOTPOSSIBLE)