X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-text-utils.c;h=0a84acf73403d0b7255a61cc68599cb2ea10f33d;hp=45555ce7ba6213695a12596b5285fc14b35521b1;hb=dd00071e3b3dba6e7d35f7142ba61a89c8f205c3;hpb=fd44d68efc59bf8d3f70e70bb1df7e6885228188 diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index 45555ce..0a84acf 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -333,6 +333,50 @@ modest_text_utils_convert_to_html (const gchar *data) return g_string_free (html, FALSE); } +GSList * +modest_text_utils_split_addresses_list (const gchar *addresses) +{ + gchar *current, *start, *last_blank; + GSList *result = NULL; + + start = (gchar *) addresses; + current = start; + last_blank = start; + + while (*current != '\0') { + if ((start == current)&&((*current == ' ')||(*current == ','))) { + start++; + last_blank = current; + } else if (*current == ',') { + gchar *new_address = NULL; + new_address = g_strndup (start, current - last_blank); + result = g_slist_prepend (result, new_address); + start = current + 1; + last_blank = start; + } else if (*current == '\"') { + if (current == start) { + current++; + start++; + } + while ((*current != '\"')&&(*current != '\0')) + current++; + } + + current++; + } + + if (start != current) { + gchar *new_address = NULL; + new_address = g_strndup (start, current - last_blank); + result = g_slist_prepend (result, new_address); + } + + result = g_slist_reverse (result); + return result; + +} + + /* ******************************************************************* */ /* ************************* UTILIY FUNCTIONS ************************ */ /* ******************************************************************* */