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
2008-10-28 Sergey Poznyakoff <gray@gnu.org.ua>
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.
Change handling of query part in a URL.
Queries are now parsed into arguments and returned as arrays
of arguments.
* libproto/include/url0.h (struct _mu_url): Replace query with
array of query arguments.
* include/mailutils/url.h (mu_url_dup): New proto.
(mu_url_get_query): Remove.
(mu_url_sget_query, mu_url_aget_query): Return query split into
arguments.
(mu_url_set_scheme): New function.
(mu_url_decode_len): New function.
* mailbox/url.c (mu_url_dup): New function.
(mu_url_get_query): Remove.
(mu_url_sget_query, mu_url_aget_query): Return query split into
arguments.
(mu_url_set_scheme): New function.
(mu_url_decode_len): New function.
* libproto/remote/mbox.c (remote_mbox_init): Use parsed out URL,
instead of the full URL string.
* examples/url-parse.c: Change query output.
* mailbox/testsuite/Urls: Reflect changes to url-parse. Add new
testcases.
* libproto/imap/url.c, libproto/pop/url.c: Reflect changes to URL
functions.
2008-10-25 Sergey Poznyakoff <gray@gnu.org.ua>
Initial implementation of a `prog' mailer.
......
......@@ -31,8 +31,8 @@ extern "C" {
#define MU_ARGCV_RETURN_DELIMS 0x01
extern int mu_argcv_get (const char *command, const char *delim,
const char* cmnt,
int *argc, char ***argv);
const char *cmnt,
int *argc, char ***argv);
extern int mu_argcv_get_n (const char *command, int len,
const char *delim, const char *cmnt,
int *argc, char ***argv);
......
......@@ -173,7 +173,7 @@ _create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, const char *name)
}
mbox->url = url;
/* Create the folder before initializing the concrete mailbox.
The mailbox needs it's back pointer. */
status = mailbox_folder_create (mbox, name, record);
......@@ -182,7 +182,11 @@ _create_mailbox0 (mu_mailbox_t *pmbox, mu_url_t url, const char *name)
status = m_init (mbox); /* Create the concrete mailbox type. */
if (status != 0)
mu_mailbox_destroy (&mbox);
{
/* Take care not to destroy url. Leave it to caller. */
mbox->url = NULL;
mu_mailbox_destroy (&mbox);
}
else
{
*pmbox = mbox;
......@@ -219,6 +223,8 @@ _create_mailbox (mu_mailbox_t *pmbox, const char *name)
status = mu_url_parse (url);
if (status == 0)
status = _create_mailbox0 (pmbox, url, name);
if (status)
mu_url_destroy (&url);
return status;
}
......
......@@ -1373,6 +1373,8 @@ mu_decode_filter (mu_stream_t *pfilter, mu_stream_t input,
int
mu_is_proto (const char *p)
{
if (*p == '|')
return 1;
for (; *p && *p != '/'; p++)
if (*p == ':')
return 1;
......