From: Timo Sirainen Date: Mon, 7 Dec 2009 19:44:00 +0000 (-0500) Subject: imap-* plugins: Advertise capability only if user actually has plugin loaded. X-Git-Tag: 2.0.beta1~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd2cd224d3216a243d55c71c298a5b7684de0ac4;p=thirdparty%2Fdovecot%2Fcore.git imap-* plugins: Advertise capability only if user actually has plugin loaded. --HG-- branch : HEAD --- diff --git a/src/plugins/imap-acl/imap-acl-plugin.c b/src/plugins/imap-acl/imap-acl-plugin.c index b1d5ecf469..c79e73b3ba 100644 --- a/src/plugins/imap-acl/imap-acl-plugin.c +++ b/src/plugins/imap-acl/imap-acl-plugin.c @@ -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; } diff --git a/src/plugins/imap-quota/imap-quota-plugin.c b/src/plugins/imap-quota/imap-quota-plugin.c index 740849b7a7..9204f9491a 100644 --- a/src/plugins/imap-quota/imap-quota-plugin.c +++ b/src/plugins/imap-quota/imap-quota-plugin.c @@ -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; }