diff options
-rw-r--r-- | filter/ChangeLog | 4 | ||||
-rw-r--r-- | filter/filter-rule.c | 15 | ||||
-rw-r--r-- | filter/filter-rule.h | 2 |
3 files changed, 21 insertions, 0 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index c6de003925..382b815c4c 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,7 @@ +2001-02-28 Not Zed <NotZed@Ximian.com> + + * filter-rule.c (filter_rule_clone): New function to clone rules. + 2001-02-23 Not Zed <NotZed@Ximian.com> * filtertypes.xml: Added mailing list matching rules. diff --git a/filter/filter-rule.c b/filter/filter-rule.c index 663e9d7f81..c5d36d3496 100644 --- a/filter/filter-rule.c +++ b/filter/filter-rule.c @@ -138,6 +138,21 @@ filter_rule_new () return o; } +FilterRule * +filter_rule_clone(FilterRule *base, RuleContext *f) +{ + xmlNodePtr xml; + FilterRule *rule; + + /* TODO: do this more directly/efficiently */ + xml = filter_rule_xml_encode(base); + rule = gtk_type_new(((GtkObject *)base)->klass->type); + filter_rule_xml_decode(rule, xml, f); + xmlFreeNodeList(xml); + + return rule; +} + void filter_rule_set_name (FilterRule *fr, const char *name) { diff --git a/filter/filter-rule.h b/filter/filter-rule.h index 8c6f9cf42b..3fc00fe598 100644 --- a/filter/filter-rule.h +++ b/filter/filter-rule.h @@ -73,6 +73,8 @@ struct _FilterRuleClass { guint filter_rule_get_type (void); FilterRule *filter_rule_new (void); +FilterRule *filter_rule_clone (FilterRule *base, struct _RuleContext *f); + /* methods */ void filter_rule_set_name (FilterRule *fr, const char *name); void filter_rule_set_source (FilterRule *fr, const char *source); |