Fixes NB#124324, remove the original instance of "Fw:" in any of its forms ("FW:...
authorSergio Villar Senin <svillar@igalia.com>
Thu, 25 Jun 2009 11:23:33 +0000 (13:23 +0200)
committerSergio Villar Senin <svillar@igalia.com>
Thu, 25 Jun 2009 11:24:38 +0000 (13:24 +0200)
src/modest-text-utils.c

index 2b7cbb5..99c4bf6 100644 (file)
@@ -316,7 +316,23 @@ modest_text_utils_derived_subject (const gchar *subject, const gchar *prefix)
                        tmp += prefix_len;
                        tmp = g_strchug (tmp);
                } else {
-                       break;
+                       gchar *prefix_down, *tmp_down;
+
+                       /* We need this to properly check the cases of
+                          some clients adding FW: instead of Fw: for
+                          example */
+                       prefix_down = g_utf8_strdown (prefix, -1);
+                       tmp_down = g_utf8_strdown (tmp, -1);
+                       if (g_str_has_prefix (tmp_down, prefix_down)) {
+                               tmp += prefix_len;
+                               tmp = g_strchug (tmp);
+                               g_free (prefix_down);
+                               g_free (tmp_down);
+                       } else {
+                               g_free (prefix_down);
+                               g_free (tmp_down);
+                               break;
+                       }
                }
        } while (tmp);