Remove extra spaces in the middle of an address field.
[modest] / src / modest-text-utils.c
index f84f2f6..fef874c 100644 (file)
@@ -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)
 {
@@ -2047,7 +2065,7 @@ gchar *
 modest_text_utils_get_secure_header (const gchar *value,
                                     const gchar *header)
 {
-       const gint max_len = 2048;
+       const gint max_len = 16384;
        gchar *new_value = NULL;
        gchar *needle = g_strrstr (value, header);