Commit f3106927 f3106927f5ae62e96f31419f99f1a9e3bdad5c81 by Sergey Poznyakoff

Minor fixes.

* mailbox/mailbox.c (_create_mailbox0): Take care not to destroy
url, if creation of the mailbox failed.
(_create_mailbox): Destroy url if unable to create mailbox.

* mailbox/mutil.c (mu_is_proto): Take starting | as a protocol
specification. A kludge.

* include/mailutils/argcv.h: Fix indentation.
1 parent 4ef89f34
1 2008-10-28 Sergey Poznyakoff <gray@gnu.org.ua>
2
3 Minor fixes.
4
5 * mailbox/mailbox.c (_create_mailbox0): Take care not to destroy
6 url, if creation of the mailbox failed.
7 (_create_mailbox): Destroy url if unable to create mailbox.
8
9 * mailbox/mutil.c (mu_is_proto): Take starting | as a protocol
10 specification. A kludge.
11
12 * include/mailutils/argcv.h: Fix indentation.
13
14 Change handling of query part in a URL.
15
16 Queries are now parsed into arguments and returned as arrays
17 of arguments.
18
19 * libproto/include/url0.h (struct _mu_url): Replace query with
20 array of query arguments.
21 * include/mailutils/url.h (mu_url_dup): New proto.
22 (mu_url_get_query): Remove.
23 (mu_url_sget_query, mu_url_aget_query): Return query split into
24 arguments.
25 (mu_url_set_scheme): New function.
26 (mu_url_decode_len): New function.
27 * mailbox/url.c (mu_url_dup): New function.
28 (mu_url_get_query): Remove.
29 (mu_url_sget_query, mu_url_aget_query): Return query split into
30 arguments.
31 (mu_url_set_scheme): New function.
32 (mu_url_decode_len): New function.
33
34 * libproto/remote/mbox.c (remote_mbox_init): Use parsed out URL,
35 instead of the full URL string.
36
37 * examples/url-parse.c: Change query output.
38 * mailbox/testsuite/Urls: Reflect changes to url-parse. Add new
39 testcases.
40
41 * libproto/imap/url.c, libproto/pop/url.c: Reflect changes to URL
42 functions.
43
1 2008-10-25 Sergey Poznyakoff <gray@gnu.org.ua> 44 2008-10-25 Sergey Poznyakoff <gray@gnu.org.ua>
2 45
3 Initial implementation of a `prog' mailer. 46 Initial implementation of a `prog' mailer.
......
...@@ -31,8 +31,8 @@ extern "C" { ...@@ -31,8 +31,8 @@ extern "C" {
31 #define MU_ARGCV_RETURN_DELIMS 0x01 31 #define MU_ARGCV_RETURN_DELIMS 0x01
32 32
33 extern int mu_argcv_get (const char *command, const char *delim, 33 extern int mu_argcv_get (const char *command, const char *delim,
34 const char* cmnt, 34 const char *cmnt,
35 int *argc, char ***argv); 35 int *argc, char ***argv);
36 extern int mu_argcv_get_n (const char *command, int len, 36 extern int mu_argcv_get_n (const char *command, int len,
37 const char *delim, const char *cmnt, 37 const char *delim, const char *cmnt,
38 int *argc, char ***argv); 38 int *argc, char ***argv);
......
...@@ -173,7 +173,7 @@ _create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, const char *name) ...@@ -173,7 +173,7 @@ _create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, const char *name)
173 } 173 }
174 174
175 mbox->url = url; 175 mbox->url = url;
176 176
177 /* Create the folder before initializing the concrete mailbox. 177 /* Create the folder before initializing the concrete mailbox.
178 The mailbox needs it's back pointer. */ 178 The mailbox needs it's back pointer. */
179 status = mailbox_folder_create (mbox, name, record); 179 status = mailbox_folder_create (mbox, name, record);
...@@ -182,7 +182,11 @@ _create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, const char *name) ...@@ -182,7 +182,11 @@ _create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, const char *name)
182 status = m_init (mbox); /* Create the concrete mailbox type. */ 182 status = m_init (mbox); /* Create the concrete mailbox type. */
183 183
184 if (status != 0) 184 if (status != 0)
185 mu_mailbox_destroy (&mbox); 185 {
186 /* Take care not to destroy url. Leave it to caller. */
187 mbox->url = NULL;
188 mu_mailbox_destroy (&mbox);
189 }
186 else 190 else
187 { 191 {
188 *pmbox = mbox; 192 *pmbox = mbox;
...@@ -219,6 +223,8 @@ _create_mailbox (mu_mailbox_t *pmbox, const char *name) ...@@ -219,6 +223,8 @@ _create_mailbox (mu_mailbox_t *pmbox, const char *name)
219 status = mu_url_parse (url); 223 status = mu_url_parse (url);
220 if (status == 0) 224 if (status == 0)
221 status = _create_mailbox0 (pmbox, url, name); 225 status = _create_mailbox0 (pmbox, url, name);
226 if (status)
227 mu_url_destroy (&url);
222 return status; 228 return status;
223 } 229 }
224 230
......
...@@ -1373,6 +1373,8 @@ mu_decode_filter (mu_stream_t *pfilter, mu_stream_t input, ...@@ -1373,6 +1373,8 @@ mu_decode_filter (mu_stream_t *pfilter, mu_stream_t input,
1373 int 1373 int
1374 mu_is_proto (const char *p) 1374 mu_is_proto (const char *p)
1375 { 1375 {
1376 if (*p == '|')
1377 return 1;
1376 for (; *p && *p != '/'; p++) 1378 for (; *p && *p != '/'; p++)
1377 if (*p == ':') 1379 if (*p == ':')
1378 return 1; 1380 return 1;
......