From f9d0db03faef147752790fe0d0e254b954776b61 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 8 Sep 2000 20:36:14 +0000 Subject: Added scoring xml stuffs 2000-09-08 Jeffrey Stedfast * filtertypes.xml: Added scoring xml stuffs * Makefile.am: added filter-score.[c,h] * filter-score.[c,h]: New functions to handle the "score" filter type. * filter-element.c (filter_element_new_type_name): Added support for "score" type. * filter-driver.c (do_score): New ESExp callback for filter actions to set the score on a message. * filter-message-search.c (get_score): New ESExp callback for getting the score tag as an integer value. svn path=/trunk/; revision=5274 --- filter/filter-driver.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'filter/filter-driver.c') diff --git a/filter/filter-driver.c b/filter/filter-driver.c index e7c733b6a7..a233b580ad 100644 --- a/filter/filter-driver.c +++ b/filter/filter-driver.c @@ -79,6 +79,7 @@ static ESExpResult *mark_forward (struct _ESExp *f, int argc, struct _ESExpResul static ESExpResult *mark_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); static ESExpResult *do_stop (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); static ESExpResult *do_colour (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); +static ESExpResult *do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *); /* these are our filter actions - each must have a callback */ static struct { @@ -92,6 +93,7 @@ static struct { { "copy-to", (ESExpFunc *) mark_copy, 0 }, { "stop", (ESExpFunc *) do_stop, 0 }, { "set-colour", (ESExpFunc *) do_colour, 0 }, + { "set-score", (ESExpFunc *) do_score, 0 } }; static GtkObjectClass *filter_driver_parent; @@ -303,7 +305,7 @@ do_colour (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver struct _FilterDriverPrivate *p = _PRIVATE (driver); if (!p->terminated) { - d(fprintf (stderr, "setting colour flag\n")); + d(fprintf (stderr, "setting colour tag\n")); if (argc > 0 && argv[0]->type == ESEXP_RES_STRING) { camel_tag_set (&p->info->user_tags, "colour", argv[0]->value.string); } @@ -312,6 +314,25 @@ do_colour (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver return NULL; } +static ESExpResult * +do_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *driver) +{ + struct _FilterDriverPrivate *p = _PRIVATE (driver); + + if (!p->terminated) { + d(fprintf (stderr, "setting score tag\n")); + if (argc > 0 && argv[0]->type == ESEXP_RES_INT) { + char *value; + + value = g_strdup_printf ("%d", argv[0]->value.number); + camel_tag_set (&p->info->user_tags, "score", value); + g_free (value); + } + } + + return NULL; +} + static CamelFolder * open_folder (FilterDriver *driver, const char *folder_url) { -- cgit v1.2.3