From 68ec840bca073bc8e8ea2f58ad36078df9c619c1 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 15 Jul 2002 01:46:17 +0000 Subject: ** fixes for #10781 2002-07-10 Not Zed ** fixes for #10781 * filter-int.c (xml_encode): (xml_decode): Handle encoding/decoding with a type name, in a manner compatible with the score/label elemtns. (filter_int_new_type): New constructor to create a generic 'int' type. * filter-score.c: Removed. Now relies on using a filter-int with appropriate settings. * filter-label.[ch]: Now inherits from filter-int. * rule-context.c (rule_context_revert): New method to revert a filter context back to a user-file's definition. (revert): implementation. * filter-rule.h: Added new virtual method _eq and wrapper, and fixed all subclasses to implement it. * filter-element.h: Added new virtual method _eq and wrapper. Fixed all subclasses to implement it. svn path=/trunk/; revision=17448 --- filter/filter-file.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'filter/filter-file.c') diff --git a/filter/filter-file.c b/filter/filter-file.c index 7a0d1468e6..b34dd0f773 100644 --- a/filter/filter-file.c +++ b/filter/filter-file.c @@ -44,6 +44,7 @@ #define d(x) static gboolean validate (FilterElement *fe); +static int file_eq(FilterElement *fe, FilterElement *cm); static void xml_create(FilterElement *fe, xmlNodePtr node); static xmlNodePtr xml_encode(FilterElement *fe); static int xml_decode(FilterElement *fe, xmlNodePtr node); @@ -102,6 +103,7 @@ filter_file_class_init (FilterFileClass *klass) /* override methods */ filter_element->validate = validate; + filter_element->eq = file_eq; filter_element->xml_create = xml_create; filter_element->xml_encode = xml_encode; filter_element->xml_decode = xml_decode; @@ -197,6 +199,18 @@ validate (FilterElement *fe) return TRUE; } +static int +file_eq(FilterElement *fe, FilterElement *cm) +{ + FilterFile *ff = (FilterFile *)fe, *cf = (FilterFile *)cm; + + return ((FilterElementClass *)(parent_class))->eq(fe, cm) + && ((ff->path && cf->path && strcmp(ff->path, cf->path) == 0) + || (ff->path == NULL && cf->path == NULL)) + && ((ff->type && cf->type && strcmp(ff->type, cf->type) == 0) + || (ff->type == NULL && cf->type == NULL)); +} + static void xml_create (FilterElement *fe, xmlNodePtr node) { -- cgit v1.2.3