aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--antispam-plugin.h13
-rw-r--r--signature-log.c4
2 files changed, 16 insertions, 1 deletions
diff --git a/antispam-plugin.h b/antispam-plugin.h
index 6ca975f..468d43e 100644
--- a/antispam-plugin.h
+++ b/antispam-plugin.h
@@ -5,6 +5,7 @@
#include "str.h"
#include "client.h"
#include "ostream.h"
+#include "dict.h"
#include "imap-search.h"
#include "dovecot-version.h"
@@ -111,6 +112,12 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED)
{
return o_stream_create_fd(fd, 0, TRUE);
}
+
+static inline struct dict *
+string_dict_init(const char *uri, const char *username)
+{
+ return dict_init(uri, DICT_DATA_TYPE_STRING, username);
+}
#elif DOVECOT_VERSION_CODE(1, 0) == DOVECOT_VERSION
#define ME(err)
#define PLUGIN_ID
@@ -133,6 +140,12 @@ o_stream_create_from_fd(int fd, pool_t pool)
{
return o_stream_create_file(fd, pool, 0, TRUE);
}
+
+static inline struct dict *
+string_dict_init(const char *uri, const char *username)
+{
+ return dict_init(uri, username);
+}
#else
#error "Building against this dovecot version is not supported"
#endif
diff --git a/signature-log.c b/signature-log.c
index 2cd9aa7..ab8cd6d 100644
--- a/signature-log.c
+++ b/signature-log.c
@@ -51,7 +51,7 @@ backend_start(struct mailbox *box __attr_unused__)
ast = i_new(struct antispam_transaction_context, 1);
- ast->dict = dict_init(dict_uri, dict_user);
+ ast->dict = string_dict_init(dict_uri, dict_user);
/* see comment below */
// if (ast->dict)
@@ -94,6 +94,7 @@ int backend_handle_mail(struct mailbox_transaction_context *t,
if (!ast->dict) {
mail_storage_set_error(t->box->storage,
+ ME(NOTPOSSIBLE)
"Failed to initialise dict connection");
return -1;
}
@@ -125,6 +126,7 @@ int backend_handle_mail(struct mailbox_transaction_context *t,
ret = dict_transaction_commit(ast->dict_ctx);
if (ret)
mail_storage_set_error(t->box->storage,
+ ME(NOTPOSSIBLE)
"Failed to count signature");
return ret;