dovecot-2.0: shared mailboxes: If only %%n is specified in prefi...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jul 20 21:35:57 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/ab31f0f00912
changeset: 9645:ab31f0f00912
user: Timo Sirainen <tss at iki.fi>
date: Mon Jul 20 14:35:43 2009 -0400
description:
shared mailboxes: If only %%n is specified in prefix, default to current user's domain.
diffstat:
1 file changed, 16 insertions(+), 11 deletions(-)
src/lib-storage/index/shared/shared-storage.c | 27 ++++++++++++++-----------
diffs (44 lines):
diff -r 16849c0931be -r ab31f0f00912 src/lib-storage/index/shared/shared-storage.c
--- a/src/lib-storage/index/shared/shared-storage.c Fri Jul 17 20:11:05 2009 -0400
+++ b/src/lib-storage/index/shared/shared-storage.c Mon Jul 20 14:35:43 2009 -0400
@@ -175,17 +175,8 @@ int shared_storage_get_namespace(struct
}
/* successfully matched the name. */
- if (userdomain == NULL) {
- if (username == NULL) {
- /* trying to open namespace "shared/domain"
- namespace prefix. */
- mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
- T_MAIL_ERR_MAILBOX_NOT_FOUND(*_name));
- return -1;
- }
- userdomain = domain == NULL ? username :
- t_strconcat(username, "@", domain, NULL);
- } else {
+ if (userdomain != NULL) {
+ /* user at domain given */
domain = strchr(userdomain, '@');
if (domain == NULL)
username = userdomain;
@@ -193,6 +184,20 @@ int shared_storage_get_namespace(struct
username = t_strdup_until(userdomain, domain);
domain++;
}
+ } else if (username == NULL) {
+ /* trying to open namespace "shared/domain"
+ namespace prefix. */
+ mailbox_list_set_error(list, MAIL_ERROR_NOTFOUND,
+ T_MAIL_ERR_MAILBOX_NOT_FOUND(*_name));
+ return -1;
+ } else {
+ if (domain == NULL) {
+ /* no domain given, use ours (if we have one) */
+ domain = strchr(user->username, '@');
+ if (domain != NULL) domain++;
+ }
+ userdomain = domain == NULL ? username :
+ t_strconcat(username, "@", domain, NULL);
}
if (*userdomain == '\0') {
mailbox_list_set_error(list, MAIL_ERROR_PARAMS,
More information about the dovecot-cvs
mailing list