Mercurial > dovecot > original-hg > dovecot-1.2
comparison src/lib-storage/index/shared/shared-storage.c @ 9233:518963e8a20d HEAD
shared mailboxes: If only %%n is specified in prefix, default to current user's domain.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 20 Jul 2009 14:32:25 -0400 |
parents | 4fd7b98bcff9 |
children | 00cd9aacd03c |
comparison
equal
deleted
inserted
replaced
9232:f57f9dab059b | 9233:518963e8a20d |
---|---|
190 return -1; | 190 return -1; |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 /* successfully matched the name. */ | 194 /* successfully matched the name. */ |
195 if (userdomain == NULL) { | 195 if (userdomain != NULL) { |
196 if (username == NULL) { | 196 /* user@domain given */ |
197 /* trying to open namespace "shared/domain" | |
198 namespace prefix. */ | |
199 mail_storage_set_error(_storage, MAIL_ERROR_NOTFOUND, | |
200 T_MAIL_ERR_MAILBOX_NOT_FOUND(*_name)); | |
201 return -1; | |
202 } | |
203 userdomain = domain == NULL ? username : | |
204 t_strconcat(username, "@", domain, NULL); | |
205 } else { | |
206 domain = strchr(userdomain, '@'); | 197 domain = strchr(userdomain, '@'); |
207 if (domain == NULL) | 198 if (domain == NULL) |
208 username = userdomain; | 199 username = userdomain; |
209 else { | 200 else { |
210 username = t_strdup_until(userdomain, domain); | 201 username = t_strdup_until(userdomain, domain); |
211 domain++; | 202 domain++; |
212 } | 203 } |
204 } else if (username == NULL) { | |
205 /* trying to open namespace "shared/domain" | |
206 namespace prefix. */ | |
207 mail_storage_set_error(_storage, MAIL_ERROR_NOTFOUND, | |
208 T_MAIL_ERR_MAILBOX_NOT_FOUND(*_name)); | |
209 return -1; | |
210 } else { | |
211 if (domain == NULL) { | |
212 /* no domain given, use ours (if we have one) */ | |
213 domain = strchr(user->username, '@'); | |
214 if (domain != NULL) domain++; | |
215 } | |
216 userdomain = domain == NULL ? username : | |
217 t_strconcat(username, "@", domain, NULL); | |
213 } | 218 } |
214 if (*userdomain == '\0') { | 219 if (*userdomain == '\0') { |
215 mail_storage_set_error(_storage, MAIL_ERROR_PARAMS, | 220 mail_storage_set_error(_storage, MAIL_ERROR_PARAMS, |
216 "Empty username doesn't exist"); | 221 "Empty username doesn't exist"); |
217 return -1; | 222 return -1; |