Index: filter-xml.c =================================================================== RCS file: /cvs/gnome/pan/pan/filters/filter-xml.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- filter-xml.c 30 Jan 2003 23:15:48 -0000 1.33 +++ filter-xml.c 31 Jan 2003 22:12:38 -0000 1.34 @@ -726,6 +726,7 @@ populate_phrase (FilterPhrase * f, xmlNodePtr node) { xmlChar * val; + gboolean pre_0_13_3_91 = FALSE; char * key = NULL; PhraseKeyType key_type = PHRASE_KEY_SUBJECT; PhraseMatchType match_type = PHRASE_MATCH_CONTAINS; @@ -746,7 +747,7 @@ /* key type */ val = xmlGetProp (node, "key_type"); if (val == NULL) - val = xmlGetProp (node, "type"); /* pre-0.13.4 */ + val = xmlGetProp (node, "type"); if (val != NULL) { if (!pan_strcmp (val, "subject")) key_type = PHRASE_KEY_SUBJECT; else if (!pan_strcmp (val, "author")) key_type = PHRASE_KEY_AUTHOR; @@ -760,18 +761,33 @@ /* key */ val = xmlGetProp (node, "key"); - if (val == NULL) + if (val == NULL) { + pre_0_13_3_91 = TRUE; val = xmlGetProp (node, "phrase"); /* pre=0.13.4 */ + } if (val != NULL) { key = g_strdup (val); xmlFree (val); } - /* regex flag, from pre-0.13.4 */ - if ((val = xmlGetProp (node, "is_regex")) != NULL) { - if (*val == 't') - match_type = PHRASE_MATCH_REGEX; - xmlFree (val); + /* backwards compatability to 0.13.3.90 and earlier: + * (1) it wrapped phrases with splats for some brain-damaged reason + * (2) regular expressions were denoted with their own flag. + */ + if (pre_0_13_3_91) + { + /* remove the splats */ + GString * str = g_string_new (key); + if (str->len && str->str[0]=='*') g_string_erase (str, 0, 1); + if (str->len && str->str[str->len-1]=='*') g_string_erase (str, str->len-1, 1); + replace_gstr (&key, g_string_free (str, FALSE)); + + /* check for regex flag */ + if ((val = xmlGetProp (node, "is_regex")) != NULL) { + if (*val == 't') + match_type = PHRASE_MATCH_REGEX; + xmlFree (val); + } } filter_phrase_set (f, match_type, key_type, key);