dovecot-2.0: autocreate: Fixed autosubscribing to mailboxes in s...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Aug 9 21:58:46 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/e90fd94136d0
changeset: 9751:e90fd94136d0
user: Timo Sirainen <tss at iki.fi>
date: Sun Aug 09 14:58:38 2009 -0400
description:
autocreate: Fixed autosubscribing to mailboxes in subscriptions=no namespaces.
Also log autosubscribe failures if mail_debug=yes.
diffstat:
1 file changed, 25 insertions(+), 4 deletions(-)
src/plugins/autocreate/autocreate-plugin.c | 29 ++++++++++++++++++++++++----
diffs (49 lines):
diff -r 9ae6f4e875ca -r e90fd94136d0 src/plugins/autocreate/autocreate-plugin.c
--- a/src/plugins/autocreate/autocreate-plugin.c Fri Aug 07 19:25:51 2009 -0400
+++ b/src/plugins/autocreate/autocreate-plugin.c Sun Aug 09 14:58:38 2009 -0400
@@ -56,10 +56,33 @@ static void autocreate_mailboxes(struct
}
}
+static void
+autosubscribe_mailbox(struct mail_namespace *namespaces, const char *name)
+{
+ struct mail_namespace *ns;
+ const char *str;
+ enum mail_error error;
+
+ ns = mail_namespace_find_subscribable(namespaces, &name);
+ if (ns == NULL) {
+ if (namespaces->mail_set->mail_debug)
+ i_info("autocreate: No namespace found for %s", name);
+ return;
+ }
+
+ if (mailbox_list_set_subscribed(ns->list, name, TRUE) < 0) {
+ str = mailbox_list_get_last_error(ns->list,
+ &error);
+ if (error != MAIL_ERROR_EXISTS && ns->mail_set->mail_debug) {
+ i_info("autocreate: Failed to subscribe mailbox %s: %s",
+ name, str);
+ }
+ }
+}
+
static void autosubscribe_mailboxes(struct mail_namespace *namespaces)
{
struct mail_user *user = namespaces->user;
- struct mail_namespace *ns;
char env_name[20];
const char *name;
unsigned int i;
@@ -67,9 +90,7 @@ static void autosubscribe_mailboxes(stru
i = 1;
name = mail_user_plugin_getenv(user, "autosubscribe");
while (name != NULL) {
- ns = mail_namespace_find(namespaces, &name);
- if (ns != NULL)
- (void)mailbox_list_set_subscribed(ns->list, name, TRUE);
+ autosubscribe_mailbox(namespaces, name);
i_snprintf(env_name, sizeof(env_name), "autosubscribe%d", ++i);
name = mail_user_plugin_getenv(user, env_name);
More information about the dovecot-cvs
mailing list