dovecot-2.0: lib-storage: Added mail_user_is_plugin_loaded().

dovecot at dovecot.org dovecot at dovecot.org
Mon Dec 7 21:45:58 EET 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/1062e6ca6310
changeset: 10419:1062e6ca6310
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Dec 07 14:43:39 2009 -0500
description:
lib-storage: Added mail_user_is_plugin_loaded().

diffstat:

2 files changed, 17 insertions(+)
src/lib-storage/mail-user.c |   13 +++++++++++++
src/lib-storage/mail-user.h |    4 ++++

diffs (51 lines):

diff -r 932afc022ea1 -r 1062e6ca6310 src/lib-storage/mail-user.c
--- a/src/lib-storage/mail-user.c	Mon Dec 07 14:43:29 2009 -0500
+++ b/src/lib-storage/mail-user.c	Mon Dec 07 14:43:39 2009 -0500
@@ -4,6 +4,7 @@
 #include "array.h"
 #include "hostpid.h"
 #include "network.h"
+#include "module-dir.h"
 #include "home-expand.h"
 #include "str.h"
 #include "strescape.h"
@@ -279,6 +280,18 @@ int mail_user_get_home(struct mail_user 
 	return ret;
 }
 
+bool mail_user_is_plugin_loaded(struct mail_user *user, struct module *module)
+{
+	const char *const *plugins;
+	bool ret;
+
+	T_BEGIN {
+		plugins = t_strsplit_spaces(user->set->mail_plugins, ", ");
+		ret = str_array_find(plugins, module_get_plugin_name(module));
+	} T_END;
+	return ret;
+}
+
 const char *mail_user_plugin_getenv(struct mail_user *user, const char *name)
 {
 	return mail_user_set_plugin_getenv(user->set, name);
diff -r 932afc022ea1 -r 1062e6ca6310 src/lib-storage/mail-user.h
--- a/src/lib-storage/mail-user.h	Mon Dec 07 14:43:29 2009 -0500
+++ b/src/lib-storage/mail-user.h	Mon Dec 07 14:43:39 2009 -0500
@@ -3,6 +3,7 @@
 
 #include "mail-storage-settings.h"
 
+struct module;
 struct mail_user;
 
 struct mail_user_vfuncs {
@@ -88,6 +89,9 @@ int mail_user_get_home(struct mail_user 
 /* Returns path + file prefix for creating a temporary file. Uses home
    directory if possible, fallbacks to mail directory. */
 const char *mail_user_get_temp_prefix(struct mail_user *user);
+
+/* Returns TRUE if plugin is loaded for the user. */
+bool mail_user_is_plugin_loaded(struct mail_user *user, struct module *module);
 /* If name exists in plugin_envs, return its value. */
 const char *mail_user_plugin_getenv(struct mail_user *user, const char *name);
 const char *mail_user_set_plugin_getenv(const struct mail_user_settings *set,


More information about the dovecot-cvs mailing list