]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-* plugins: Advertise capability only if user actually has plugin loaded.
authorTimo Sirainen <tss@iki.fi>
Mon, 7 Dec 2009 19:44:00 +0000 (14:44 -0500)
committerTimo Sirainen <tss@iki.fi>
Mon, 7 Dec 2009 19:44:00 +0000 (14:44 -0500)
--HG--
branch : HEAD

src/plugins/imap-acl/imap-acl-plugin.c
src/plugins/imap-quota/imap-quota-plugin.c

index b1d5ecf4692731faa68e34b290a92ea69c9d9db9..c79e73b3ba705cdab6e406ca8a54fb6b8e6e3f58 100644 (file)
@@ -49,6 +49,7 @@ static const struct imap_acl_letter_map imap_acl_letter_map[] = {
 
 const char *imap_acl_plugin_version = PACKAGE_VERSION;
 
+static struct module *imap_acl_module;
 static void (*next_hook_client_created)(struct client **client);
 
 static struct mailbox *
@@ -615,13 +616,14 @@ static bool cmd_deleteacl(struct client_command_context *cmd)
 
 static void imap_acl_client_created(struct client **client)
 {
-       str_append((*client)->capability_string, " ACL RIGHTS=texk");
+       if (mail_user_is_plugin_loaded((*client)->user, imap_acl_module))
+               str_append((*client)->capability_string, " ACL RIGHTS=texk");
 
        if (next_hook_client_created != NULL)
                next_hook_client_created(client);
 }
 
-void imap_acl_plugin_init(struct module *module ATTR_UNUSED)
+void imap_acl_plugin_init(struct module *module)
 {
        command_register("LISTRIGHTS", cmd_listrights, 0);
        command_register("GETACL", cmd_getacl, 0);
@@ -629,6 +631,7 @@ void imap_acl_plugin_init(struct module *module ATTR_UNUSED)
        command_register("SETACL", cmd_setacl, 0);
        command_register("DELETEACL", cmd_deleteacl, 0);
 
+       imap_acl_module = module;
        next_hook_client_created = hook_client_created;
        hook_client_created = imap_acl_client_created;
 }
index 740849b7a7c6e0d3b62c5a20d792bafac6bb412d..9204f9491a9e5fdc0236b8a8bcb8560e280aafb6 100644 (file)
@@ -14,6 +14,8 @@
 #define QUOTA_USER_SEPARATOR ':'
 
 const char *imap_quota_plugin_version = PACKAGE_VERSION;
+
+static struct module *imap_quota_module;
 static void (*next_hook_client_created)(struct client **client);
 
 static const char *
@@ -199,18 +201,20 @@ static bool cmd_setquota(struct client_command_context *cmd)
 
 static void imap_quota_client_created(struct client **client)
 {
-       str_append((*client)->capability_string, " QUOTA");
+       if (mail_user_is_plugin_loaded((*client)->user, imap_quota_module))
+               str_append((*client)->capability_string, " QUOTA");
 
        if (next_hook_client_created != NULL)
                next_hook_client_created(client);
 }
 
-void imap_quota_plugin_init(struct module *module ATTR_UNUSED)
+void imap_quota_plugin_init(struct module *module)
 {
        command_register("GETQUOTAROOT", cmd_getquotaroot, 0);
        command_register("GETQUOTA", cmd_getquota, 0);
        command_register("SETQUOTA", cmd_setquota, 0);
 
+       imap_quota_module = module;
        next_hook_client_created = hook_client_created;
        hook_client_created = imap_quota_client_created;
 }