From 96ccc526ae2d2eeb91964a537ff7897dda7bb2b5 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Wed, 26 Sep 2001 19:35:41 +0000 Subject: Fixes glitch in mailto: url parsing that caused it to fail when recipient 2001-09-26 Jon Trowbridge * e-msg-composer.c (e_msg_composer_new_from_url): Fixes glitch in mailto: url parsing that caused it to fail when recipient names contained commas. (Bug #10796) svn path=/trunk/; revision=13156 --- composer/ChangeLog | 6 ++++++ composer/e-msg-composer.c | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/composer/ChangeLog b/composer/ChangeLog index 5447f9676b..81bf1550ef 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,9 @@ +2001-09-26 Jon Trowbridge + + * e-msg-composer.c (e_msg_composer_new_from_url): Fixes glitch in + mailto: url parsing that caused it to fail when recipient names + contained commas. (Bug #10796) + 2001-09-20 Jeffrey Stedfast * e-msg-composer.c (save_draft): Update to reflect changes to diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index fc4ca817ce..61ba59b32b 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -2763,7 +2763,7 @@ add_recipients (GList *list, const char *recips, gboolean decode) * defined by the provided URL. **/ EMsgComposer * -e_msg_composer_new_from_url (const char *url) +e_msg_composer_new_from_url (const char *url_in) { EMsgComposer *composer; EMsgComposerHdrs *hdrs; @@ -2772,20 +2772,24 @@ e_msg_composer_new_from_url (const char *url) char *subject = NULL, *body = NULL; const char *p, *header; int len, clen; - char *content; + char *url, *content; + - g_return_val_if_fail (g_strncasecmp (url, "mailto:", 7) == 0, NULL); + g_return_val_if_fail (g_strncasecmp (url_in, "mailto:", 7) == 0, NULL); composer = e_msg_composer_new (); if (!composer) return NULL; + url = g_strdup (url_in); + camel_url_decode (url); + /* Parse recipients (everything after ':' until '?' or eos. */ p = url + 7; - len = strcspn (p, "?,"); + len = strcspn (p, "?"); if (len) { content = g_strndup (p, len); - to = add_recipients (to, content, TRUE); + to = add_recipients (to, content, FALSE); g_free (content); } @@ -2806,7 +2810,7 @@ e_msg_composer_new_from_url (const char *url) clen = strcspn (p, "&"); content = g_strndup (p, clen); camel_url_decode (content); - + if (!g_strncasecmp (header, "to", len)) to = add_recipients (to, content, FALSE); else if (!g_strncasecmp (header, "cc", len)) -- cgit