aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-filter-driver.c25
-rw-r--r--camel/camel-filter-driver.h1
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);*/