aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-11-11 12:04:12 +0100
committerJohannes Berg <johannes@sipsolutions.net>2008-11-11 12:04:12 +0100
commitae940d8ab29da4a09d4d0ec5a8fdc87b40382407 (patch)
treefc0cc45cfae42fdc4a49ff690a0d2dc0e7d9c101
parentcf194d158db5c09364c15487da9b24844c7622a9 (diff)
downloaddovecot-antispam-ae940d8ab29da4a09d4d0ec5a8fdc87b40382407.tar.gz
dovecot-antispam-ae940d8ab29da4a09d4d0ec5a8fdc87b40382407.tar.xz
dovecot-antispam-ae940d8ab29da4a09d4d0ec5a8fdc87b40382407.zip
fix signature-log backend compilation with dovecot 1.1
-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;