From fa4f64debd30776d872d98168cae692e7dd2763d Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Fri, 6 Nov 2009 13:17:48 +0100 Subject: [PATCH] Remove extra spaces in the middle of an address field. --- src/modest-text-utils.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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) { -- 1.7.9.5