# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../dovecot-antispam/antispam-plugin.h.patch # Copyright (C) 2009 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- X-Git-Url: http://git.sipsolutions.net/gitweb.cgi?p=dovecot-antispam.git;a=blobdiff_plain;f=antispam-plugin.h;h=493fd1eb0f6b4643e059e660b25aee81dd1336ba;hp=df59e88e10ce68bc4f6a2ea012487d566f6f3e14;hb=af0f8f8de27901e2efb9560a1fc66c7af3cd810b;hpb=8f7c08bc8a39c22b3cca1e306cf454d64b405b8c diff --git a/antispam-plugin.h b/antispam-plugin.h index df59e88..493fd1e 100644 --- a/antispam-plugin.h +++ b/antispam-plugin.h @@ -113,11 +113,24 @@ o_stream_create_from_fd(int fd, pool_t pool ATTR_UNUSED) return o_stream_create_fd(fd, 0, TRUE); } +#if DOVECOT_VERSION_CODE(1, 2) == DOVECOT_VERSION +static inline struct dict * +string_dict_init(const char *uri, const char *username) +{ + const char *base_dir; + + base_dir = getenv("BASE_DIR"); + if (base_dir == NULL) + base_dir = "/var/run/dovecot"; + return dict_init(uri, DICT_DATA_TYPE_STRING, username, base_dir); +} +#else /* 1.1 */ static inline struct dict * string_dict_init(const char *uri, const char *username) { return dict_init(uri, DICT_DATA_TYPE_STRING, username); } +#endif #elif DOVECOT_VERSION_CODE(1, 0) == DOVECOT_VERSION #define ME(err) #define PLUGIN_ID