scoring & bugfix for filtering
authorHoà Viêt Dinh <dinh.viet.hoa@free.fr>
Sun, 6 May 2001 04:48:43 +0000 (04:48 +0000)
committerHoà Viêt Dinh <dinh.viet.hoa@free.fr>
Sun, 6 May 2001 04:48:43 +0000 (04:48 +0000)
ChangeLog.claws
src/filter.c
src/procheader.c

index 4e90f0a..0fbe6e6 100644 (file)
@@ -42,6 +42,9 @@
        * src/textview.c
                use procheader_parse_header(), procheader_headername_equal()
                removed memory leak in text_scan_header when freeing headers
+       * src/filter.c
+               changed the function to match names of headers
+               using procheader_headername_equal()
 
        Scoring functions are implemented, an interface is needed
        to configure that.
index 268a94c..15cb21d 100644 (file)
@@ -118,13 +118,15 @@ gboolean filter_match_condition(Filter *filter, GSList *hlist)
                        header = hlist->data;
 
                        if (!match1 &&
-                           !strcasecmp(header->name, filter->name1)) {
+                           procheader_headername_equal(header->name,
+                                                       filter->name1)) {
                                if (!filter->body1 ||
                                    StrFind1(header->body, filter->body1))
                                        match1 = TRUE;
                        }
                        if (!match2 &&
-                           !strcasecmp(header->name, filter->name2)) {
+                           procheader_headername_equal(header->name,
+                                                        filter->name2)) {
                                if (!filter->body2 ||
                                    StrFind2(header->body, filter->body2))
                                        match2 = TRUE;
@@ -136,12 +138,14 @@ gboolean filter_match_condition(Filter *filter, GSList *hlist)
                for (; hlist != NULL; hlist = hlist->next) {
                        header = hlist->data;
 
-                       if (!strcasecmp(header->name, filter->name1))
+                       if (procheader_headername_equal(header->name,
+                                                       filter->name1))
                                if (!filter->body1 ||
                                    StrFind1(header->body, filter->body1))
                                        return TRUE;
                        if (filter->name2 &&
-                           !strcasecmp(header->name, filter->name2))
+                           procheader_headername_equal(header->name,
+                                                       filter->name2))
                                if (!filter->body2 ||
                                    StrFind2(header->body, filter->body2))
                                        return TRUE;
index ba5133f..64252ad 100644 (file)
@@ -193,7 +193,8 @@ gchar *procheader_get_unfolded_line(gchar *buf, gint len, FILE *fp)
 }
 
 /*
-  tests whether two headers are equal
+  tests whether two headers' names are equal
+  remove the trailing ':' or ' ' before comparing
 */
 
 gboolean procheader_headername_equal(char * hdr1, char * hdr2)