diff options
-rw-r--r-- | camel/ChangeLog | 5 | ||||
-rw-r--r-- | camel/camel-filter-driver.c | 25 | ||||
-rw-r--r-- | camel/camel-filter-driver.h | 1 |
3 files changed, 30 insertions, 1 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 6e2beba630..c3265b3675 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2002-01-22 Jeffrey Stedfast <fejj@ximian.com> + + * camel-filter-driver.c (camel_filter_driver_remove_rule_by_name): + New function to remove a filter rule by name. + 2002-01-21 Jeffrey Stedfast <fejj@ximian.com> * camel-filter-driver.c (do_beep): As a temporary solution, just diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c index 0bac3a08ac..0c500b78bb 100644 --- a/camel/camel-filter-driver.c +++ b/camel/camel-filter-driver.c @@ -337,6 +337,30 @@ camel_filter_driver_add_rule(CamelFilterDriver *d, const char *name, const char e_dlist_addtail(&p->rules, (EDListNode *)node); } +int +camel_filter_driver_remove_rule_by_name (CamelFilterDriver *d, const char *name) +{ + struct _CamelFilterDriverPrivate *p = _PRIVATE (d); + struct _filter_rule *node; + + node = (struct _filter_rule *) p->rules.head; + while (node) { + if (!strcmp (node->name, name)) { + e_dlist_remove ((EDListNode *) node); + g_free (node->match); + g_free (node->action); + g_free (node->name); + g_free (node); + + return 0; + } + + node = node->next; + } + + return -1; +} + static void report_status (CamelFilterDriver *driver, enum camel_filter_status_t status, int pc, const char *desc, ...) { @@ -737,7 +761,6 @@ static gboolean run_only_once (gpointer key, char *action, struct _run_only_once *data) { struct _CamelFilterDriverPrivate *p = _PRIVATE (data->driver); - CamelFilterDriver *driver = data->driver; CamelException *ex = data->ex; ESExpResult *r; diff --git a/camel/camel-filter-driver.h b/camel/camel-filter-driver.h index 4e7c179971..04568c94b2 100644 --- a/camel/camel-filter-driver.h +++ b/camel/camel-filter-driver.h @@ -79,6 +79,7 @@ void camel_filter_driver_set_default_folder (CamelFilterDriver *d, CamelFolder void camel_filter_driver_add_rule (CamelFilterDriver *d, const char *name, const char *match, const char *action); +int camel_filter_driver_remove_rule_by_name (CamelFilterDriver *d, const char *name); /*void camel_filter_driver_set_global(CamelFilterDriver *, const char *name, const char *value);*/ |