comparison src/lib-storage/index/shared/shared-storage.c @ 8544:983d38de06c9 HEAD

var_expand(): Added support for long %{variable} names.
author Timo Sirainen <tss@iki.fi>
date Sat, 13 Dec 2008 18:04:55 +0200
parents 03c418eadc8b
children b9faf4db2a9f
comparison
equal deleted inserted replaced
8543:89a31d203d0b 8544:983d38de06c9
124 struct mail_namespace **ns_r) 124 struct mail_namespace **ns_r)
125 { 125 {
126 struct shared_storage *storage = (struct shared_storage *)_storage; 126 struct shared_storage *storage = (struct shared_storage *)_storage;
127 struct mail_user *user = _storage->ns->user; 127 struct mail_user *user = _storage->ns->user;
128 static struct var_expand_table static_tab[] = { 128 static struct var_expand_table static_tab[] = {
129 { 'u', NULL }, 129 { 'u', NULL, "user" },
130 { 'n', NULL }, 130 { 'n', NULL, "username" },
131 { 'd', NULL }, 131 { 'd', NULL, "domain" },
132 { 'h', NULL }, 132 { 'h', NULL, "home" },
133 { '\0', NULL } 133 { '\0', NULL, NULL }
134 }; 134 };
135 struct var_expand_table *tab; 135 struct var_expand_table *tab;
136 struct mail_namespace *ns; 136 struct mail_namespace *ns;
137 struct mail_user *owner; 137 struct mail_user *owner;
138 const char *domain = NULL, *username = NULL, *userdomain = NULL; 138 const char *domain = NULL, *username = NULL, *userdomain = NULL;
206 *ns_r = ns; 206 *ns_r = ns;
207 return 0; 207 return 0;
208 } 208 }
209 209
210 owner = mail_user_init(userdomain); 210 owner = mail_user_init(userdomain);
211 if (!var_has_key(storage->location, 'h')) 211 if (!var_has_key(storage->location, 'h', "home"))
212 ret = 1; 212 ret = 1;
213 else { 213 else {
214 /* we'll need to look up the user's home directory */ 214 /* we'll need to look up the user's home directory */
215 if ((ret = mail_user_get_home(owner, &tab[3].value)) < 0) { 215 if ((ret = mail_user_get_home(owner, &tab[3].value)) < 0) {
216 mail_storage_set_critical(_storage, "Namespace '%s': " 216 mail_storage_set_critical(_storage, "Namespace '%s': "