From: Jose Dapena Paz Date: Fri, 6 Nov 2009 12:17:48 +0000 (+0100) Subject: Remove extra spaces in the middle of an address field. X-Git-Tag: 3.1.12~3 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=fa4f64debd30776d872d98168cae692e7dd2763d Remove extra spaces in the middle of an address field. --- diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index 7bceaf0..fef874c 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -163,6 +163,8 @@ static gchar* modest_text_utils_quote_html (const gchar *text, GList *attachments, int limit); static gchar* get_email_from_address (const gchar *address); +static void remove_extra_spaces (gchar *string); + /* ******************************************************************* */ @@ -694,6 +696,8 @@ modest_text_utils_split_addresses_list (const gchar *addresses) addr = g_strndup (my_addrs, end - my_addrs); g_strchomp (addr); + remove_extra_spaces (addr); + head = g_slist_append (NULL, addr); head->next = modest_text_utils_split_addresses_list (end); /* recurse */ @@ -1936,6 +1940,20 @@ remove_quotes (gchar **quotes) } } +static void +remove_extra_spaces (gchar *string) +{ + gchar *start; + + start = string; + while (start && start[0] != '\0') { + if ((start[0] == ' ') && (start[1] == ' ')) { + g_strchug (start+1); + } + start++; + } +} + gchar * modest_text_utils_escape_mnemonics (const gchar *text) {