aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--antispam-plugin.c11
-rw-r--r--antispam-plugin.h8
3 files changed, 14 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index bd614f0..4c649fb 100644
--- a/Makefile
+++ b/Makefile
@@ -38,9 +38,11 @@ endif
# dovecot version rules
objs += antispam-storage-$(DOVECOT_VERSION).o
ifeq ("$(DOVECOT_VERSION)", "1.0")
+CFLAGS += -DCONFIG_DOVECOT_10
CFLAGS += -Dstr_array_length=strarray_length
CFLAGS += "-Dmempool_unref(x)=pool_unref(*(x))"
else
+CFLAGS += -DCONFIG_DOVECOT_11
CFLAGS += "-Dmempool_unref(x)=pool_unref(x)"
endif
diff --git a/antispam-plugin.c b/antispam-plugin.c
index 1e58722..fdde26d 100644
--- a/antispam-plugin.c
+++ b/antispam-plugin.c
@@ -40,6 +40,10 @@ extern void (*hook_mail_storage_created)(struct mail_storage *storage);
/* internal stuff we need */
#include "antispam-plugin.h"
+#ifdef CONFIG_DOVECOT_11
+uint32_t PLUGIN_FUNCTION(id) = 0;
+#endif
+
static pool_t global_pool;
static char **trash_folders = NULL;
static char *default_spam_folders[] = {
@@ -118,13 +122,6 @@ const char *get_setting(const char *name)
return env;
}
-#define __PLUGIN_FUNCTION(name, ioe) \
- name ## _plugin_ ## ioe
-#define _PLUGIN_FUNCTION(name, ioe) \
- __PLUGIN_FUNCTION(name, ioe)
-#define PLUGIN_FUNCTION(ioe) \
- _PLUGIN_FUNCTION(PLUGINNAME, ioe)
-
void PLUGIN_FUNCTION(init)(void)
{
const char *tmp;
diff --git a/antispam-plugin.h b/antispam-plugin.h
index 8a7958d..f614894 100644
--- a/antispam-plugin.h
+++ b/antispam-plugin.h
@@ -10,6 +10,14 @@
#define __stringify_1(x) #x
#define stringify(x) __stringify_1(x)
+#define __PLUGIN_FUNCTION(name, ioe) \
+ name ## _plugin_ ## ioe
+#define _PLUGIN_FUNCTION(name, ioe) \
+ __PLUGIN_FUNCTION(name, ioe)
+#define PLUGIN_FUNCTION(ioe) \
+ _PLUGIN_FUNCTION(PLUGINNAME, ioe)
+
+extern uint32_t PLUGIN_FUNCTION(id);
struct antispam_transaction_context;