dovecot-1.2: autocreate: Fixed autosubscribing to mailboxes in s...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Aug 9 21:55:17 EEST 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/85e39b7710ee
changeset: 9301:85e39b7710ee
user: Timo Sirainen <tss at iki.fi>
date: Sun Aug 09 14:55:11 2009 -0400
description:
autocreate: Fixed autosubscribing to mailboxes in subscriptions=no namespaces.
Also log autosubscribe failures if mail_debug=yes.
diffstat:
1 file changed, 24 insertions(+), 4 deletions(-)
src/plugins/autocreate/autocreate-plugin.c | 28 ++++++++++++++++++++++++----
diffs (47 lines):
diff -r baea3f20c914 -r 85e39b7710ee src/plugins/autocreate/autocreate-plugin.c
--- a/src/plugins/autocreate/autocreate-plugin.c Fri Aug 07 19:46:32 2009 -0400
+++ b/src/plugins/autocreate/autocreate-plugin.c Sun Aug 09 14:55:11 2009 -0400
@@ -51,9 +51,31 @@ 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 (getenv("DEBUG") != NULL)
+ 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 && getenv("DEBUG") != NULL) {
+ i_info("autocreate: Failed to create mailbox %s: %s",
+ name, str);
+ }
+ }
+}
+
static void autosubscribe_mailboxes(struct mail_namespace *namespaces)
{
- struct mail_namespace *ns;
char env_name[20];
const char *name;
unsigned int i;
@@ -61,9 +83,7 @@ static void autosubscribe_mailboxes(stru
i = 1;
name = getenv("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 = getenv(env_name);
More information about the dovecot-cvs
mailing list