dovecot-2.0: imap-* plugins: Advertise capability only if user a...
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/7330a21e7d03
changeset: 10420:7330a21e7d03
user: Timo Sirainen <tss at iki.fi>
date: Mon Dec 07 14:44:00 2009 -0500
description:
imap-* plugins: Advertise capability only if user actually has plugin loaded.
diffstat:
2 files changed, 11 insertions(+), 4 deletions(-)
src/plugins/imap-acl/imap-acl-plugin.c | 7 +++++--
src/plugins/imap-quota/imap-quota-plugin.c | 8 ++++++--
diffs (71 lines):
diff -r 1062e6ca6310 -r 7330a21e7d03 src/plugins/imap-acl/imap-acl-plugin.c
--- a/src/plugins/imap-acl/imap-acl-plugin.c Mon Dec 07 14:43:39 2009 -0500
+++ b/src/plugins/imap-acl/imap-acl-plugin.c Mon Dec 07 14:44:00 2009 -0500
@@ -49,6 +49,7 @@ static const struct 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_
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
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 -r 1062e6ca6310 -r 7330a21e7d03 src/plugins/imap-quota/imap-quota-plugin.c
--- a/src/plugins/imap-quota/imap-quota-plugin.c Mon Dec 07 14:43:39 2009 -0500
+++ b/src/plugins/imap-quota/imap-quota-plugin.c Mon Dec 07 14:44:00 2009 -0500
@@ -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_c
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;
}
More information about the dovecot-cvs
mailing list