diff options
author | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-05-28 05:37:01 +0800 |
---|---|---|
committer | Bertrand Guiheneuf <bertrand@src.gnome.org> | 1999-05-28 05:37:01 +0800 |
commit | 69912fc470a36f52887f18cf8c633f34aaa34fb5 (patch) | |
tree | 2d464ffaccbd71aad35d80871b76edc383f368db /camel/gstring-util.c | |
parent | a8a38c7a8076ca0f7976b01fe2cbd6e1e27a089b (diff) | |
download | gsoc2013-evolution-69912fc470a36f52887f18cf8c633f34aaa34fb5.tar.gz gsoc2013-evolution-69912fc470a36f52887f18cf8c633f34aaa34fb5.tar.zst gsoc2013-evolution-69912fc470a36f52887f18cf8c633f34aaa34fb5.zip |
rewrite message obtained via parsing into a file. Actually, it works
* tests/test2.c (main): rewrite message obtained via
parsing into a file. Actually, it works pretty well :))
* camel/camel-mime-message.c (_set_recipient_list_from_string):
create recipient list form a comma separated string.
(_parse_header_pair): added recipient lists parsing.
* camel/camel-mime-part.c (_parse_header_pair):
new (protected) method. Parse a head pair and
decides what to do with it.
(_add_header): Call in _parse_header_pair
* camel/camel-mime-message.c (_parse_header_pair):
overload header parsing MimePart mthod.
* camel/gstring-util.c (g_string_split):
new func: split a gstring into a GList of
substring.
svn path=/trunk/; revision=950
Diffstat (limited to 'camel/gstring-util.c')
-rw-r--r-- | camel/gstring-util.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/camel/gstring-util.c b/camel/gstring-util.c index 5d11fa91a8..32ecb9b031 100644 --- a/camel/gstring-util.c +++ b/camel/gstring-util.c @@ -246,3 +246,49 @@ g_string_list_free (GList *string_list) g_list_foreach(string_list, __g_string_list_free_string, NULL); g_list_free(string_list); } + + + + + + +GList * +g_string_split (GString *string, char sep) +{ + GList *result = NULL; + gint first, last, pos; + gchar *str; + gchar *new_str; + GString *new_gstring; + + g_assert (string); + str = string->str; + if (!str) return NULL; + + first = 0; + last = strlen(str) - 1; + + /* strip leading and trailing separators */ + while ( (first<=last) && (str[first]==sep) ) + first++; + + while ( (first<=last) && (str[last]==sep) ) + last--; + + CAMEL_LOG(FULL_DEBUG,"g_string_split:: stripping done\n"); + + while (first<=last) { + pos = first; + /* find next separator */ + while ((pos<=last) && (str[pos]!=sep)) pos++; + if (first != pos) { + new_str = g_strndup (str+first, pos-first); + new_gstring = g_string_new (new_str); + g_free (new_str); + result = g_list_append (result, new_gstring); + } + first = pos + 1; + } + + return result; +} |