aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-filter-driver.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-01-23 08:10:42 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-01-23 08:10:42 +0800
commitb66e5a238a6417d7da9efc1cf76d6a0f96346848 (patch)
treed4393c13b20bb476ac26f62f2ff444e91c0b42ce /camel/camel-filter-driver.c
parentf87bf7fa7738b61a0d9bcfc8cb9905e4355ba396 (diff)
downloadgsoc2013-evolution-b66e5a238a6417d7da9efc1cf76d6a0f96346848.tar.gz
gsoc2013-evolution-b66e5a238a6417d7da9efc1cf76d6a0f96346848.tar.zst
gsoc2013-evolution-b66e5a238a6417d7da9efc1cf76d6a0f96346848.zip
New function to remove a filter rule by name.
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. svn path=/trunk/; revision=15425
Diffstat (limited to 'camel/camel-filter-driver.c')
-rw-r--r--camel/camel-filter-driver.c25
1 files changed, 24 insertions, 1 deletions
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;