comparison src/lib-storage/index/shared/shared-storage.c @ 9575:0a00dcc4f0ea HEAD

lib-storage: Allow shared namespace prefix to use %variable modifiers.
author Timo Sirainen <tss@iki.fi>
date Wed, 26 May 2010 17:07:51 +0100
parents 00cd9aacd03c
children
comparison
equal deleted inserted replaced
9574:e63d38c7d2ba 9575:0a00dcc4f0ea
42 const char **error_r) 42 const char **error_r)
43 { 43 {
44 struct shared_storage *storage = (struct shared_storage *)_storage; 44 struct shared_storage *storage = (struct shared_storage *)_storage;
45 struct mailbox_list_settings list_set; 45 struct mailbox_list_settings list_set;
46 const char *driver, *p; 46 const char *driver, *p;
47 char *wildcardp; 47 char *wildcardp, key;
48 bool have_username; 48 bool have_username;
49 49
50 /* data must begin with the actual mailbox driver */ 50 /* data must begin with the actual mailbox driver */
51 p = strchr(data, ':'); 51 p = strchr(data, ':');
52 if (p == NULL) { 52 if (p == NULL) {
72 72
73 have_username = FALSE; 73 have_username = FALSE;
74 for (p = storage->ns_prefix_pattern; *p != '\0'; p++) { 74 for (p = storage->ns_prefix_pattern; *p != '\0'; p++) {
75 if (*p != '%') 75 if (*p != '%')
76 continue; 76 continue;
77 if (*++p == '\0') 77
78 break; 78 key = var_get_key(p + 1);
79 if (*p == 'u' || *p == 'n') 79 if (key == 'u' || key == 'n')
80 have_username = TRUE; 80 have_username = TRUE;
81 else if (*p != '%' && *p != 'd') 81 else if (key != '%' && key != 'd')
82 break; 82 break;
83 } 83 }
84 if (*p != '\0') { 84 if (*p != '\0') {
85 *error_r = "Shared namespace prefix contains unknown variables"; 85 *error_r = "Shared namespace prefix contains unknown variables";
86 return -1; 86 return -1;