aboutsummaryrefslogtreecommitdiffstats
path: root/filter/filter-driver.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-12-02 12:01:53 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-12-02 12:01:53 +0800
commite7c8c694a76a27b29056465d25347276db24519f (patch)
tree9d92e199b464ed0dcd9c014eacd0a98573194a7d /filter/filter-driver.c
parent787d1833c052cc1acf54a1d7fae5c350bdec4f94 (diff)
downloadgsoc2013-evolution-e7c8c694a76a27b29056465d25347276db24519f.tar.gz
gsoc2013-evolution-e7c8c694a76a27b29056465d25347276db24519f.tar.zst
gsoc2013-evolution-e7c8c694a76a27b29056465d25347276db24519f.zip
Added support for the system-flag type.
2000-12-01 Jeffrey Stedfast <fejj@helixcode.com> * filter-element.c (filter_element_new_type_name): Added support for the system-flag type. * Makefile.am: Added filter-system-flag.[c,h]. * filter-system-flag.[c,h]: New type for system flags. * filtertypes.xml: Oops, looks like we were still using integers as arguments to set-flag. Change over to using strings which are safer and also change the name to set-system-flag. * filter-driver.c (do_flag): Use strings instead of integers. Instead of set-flag, the callback is now set-system-flag for less confusion. Sorry Ettore, but you'll have to change your filters. * filtertypes.xml: Added system-flags stuff. * vfoldertypes.xml: And here too. * filter-message-search.c (system_flag): New ESExp callback for filtering on system flags. svn path=/trunk/; revision=6764
Diffstat (limited to 'filter/filter-driver.c')
-rw-r--r--filter/filter-driver.c47
1 files changed, 11 insertions, 36 deletions
diff --git a/filter/filter-driver.c b/filter/filter-driver.c
index bfb437bb38..e583041825 100644
--- a/filter/filter-driver.c
+++ b/filter/filter-driver.c
@@ -111,14 +111,14 @@ static struct {
int type; /* set to 1 if a function can perform shortcut evaluation, or
doesn't execute everything, 0 otherwise */
} symbols[] = {
- { "delete", (ESExpFunc *) do_delete, 0 },
- { "forward-to", (ESExpFunc *) mark_forward, 0 },
- { "copy-to", (ESExpFunc *) do_copy, 0 },
- { "move-to", (ESExpFunc *) do_move, 0 },
- { "stop", (ESExpFunc *) do_stop, 0 },
- { "set-colour", (ESExpFunc *) do_colour, 0 },
- { "set-score", (ESExpFunc *) do_score, 0 },
- { "set-flag", (ESExpFunc *) do_flag, 0 }
+ { "delete", (ESExpFunc *) do_delete, 0 },
+ { "forward-to", (ESExpFunc *) mark_forward, 0 },
+ { "copy-to", (ESExpFunc *) do_copy, 0 },
+ { "move-to", (ESExpFunc *) do_move, 0 },
+ { "stop", (ESExpFunc *) do_stop, 0 },
+ { "set-colour", (ESExpFunc *) do_colour, 0 },
+ { "set-score", (ESExpFunc *) do_score, 0 },
+ { "set-system-flag", (ESExpFunc *) do_flag, 0 }
};
static GtkObjectClass *filter_driver_parent;
@@ -450,34 +450,9 @@ do_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *d
struct _FilterDriverPrivate *p = _PRIVATE (driver);
d(fprintf (stderr, "setting flag\n"));
- if (argc > 0 && argv[0]->type == ESEXP_RES_INT) {
- char *flag;
-
- switch (argv[0]->value.number) {
- case CAMEL_MESSAGE_ANSWERED:
- p->info->flags |= CAMEL_MESSAGE_ANSWERED;
- flag = "Answered";
- break;
- case CAMEL_MESSAGE_DELETED:
- p->info->flags |= CAMEL_MESSAGE_DELETED;
- flag = "Deleted";
- break;
- case CAMEL_MESSAGE_DRAFT:
- p->info->flags |= CAMEL_MESSAGE_DRAFT;
- flag = "Draft";
- break;
- case CAMEL_MESSAGE_FLAGGED:
- p->info->flags |= CAMEL_MESSAGE_FLAGGED;
- flag = "Flagged";
- break;
- case CAMEL_MESSAGE_SEEN:
- p->info->flags |= CAMEL_MESSAGE_SEEN;
- flag = "Seen";
- break;
- default:
- flag = "Unknown";
- }
- filter_driver_log (driver, FILTER_LOG_ACTION, "Set %s flag", flag);
+ if (argc == 1 && argv[0]->type == ESEXP_RES_STRING) {
+ p->info->flags |= camel_system_flag (argv[0]->value.string);
+ filter_driver_log (driver, FILTER_LOG_ACTION, "Set %s flag", argv[0]->value.string);
}
return NULL;