Modified webpage: now tinymail repository is in gitorious.
[modest] / src / modest-text-utils.c
index 8306c60..cc02fb5 100644 (file)
@@ -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;
+}