X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-text-utils.c;h=cc02fb52b9e9e3d53ced5efb77cab0942eac0631;hp=8306c6086fea7b079444a47a6d00400a0cdb9bf3;hb=HEAD;hpb=2f1f6efa6dac4661a17e88fe6138a29daf5126cd diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index 8306c60..cc02fb5 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -883,9 +883,11 @@ unquote_line (GString * l, const gchar *quote_symbol) quote_len = strlen (quote_symbol); while (p[0]) { if (g_str_has_prefix (p, quote_symbol)) { - if (p[quote_len] == ' ') { - p += quote_len; + p+=quote_len; + while (p[0] && p[0] == ' ') { + p++; } + continue; } else { break; } @@ -2329,3 +2331,37 @@ modest_text_utils_create_colored_signature (const gchar *signature) return retval; } + +gboolean +modest_text_utils_live_search_find (const gchar *haystack, const gchar *needles) +{ + gchar *haystack_fold; + gchar *needles_fold; + gchar **needle, **current; + gboolean match; + + match = FALSE; + + haystack_fold = g_utf8_casefold (haystack, -1); + needles_fold = g_utf8_casefold (needles, -1); + + needle = g_strsplit (needles_fold, " ", -1); + + current = needle; + while (current && *current != NULL) { + + if (g_strstr_len (haystack_fold, -1, *current) != NULL) { + match = TRUE; + } else { + match = FALSE; + break; + } + current++; + } + + g_strfreev (needle); + g_free (needles_fold); + g_free (haystack_fold); + + return match; +}