From e7c8c694a76a27b29056465d25347276db24519f Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sat, 2 Dec 2000 04:01:53 +0000 Subject: Added support for the system-flag type. 2000-12-01 Jeffrey Stedfast * 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 --- filter/filter-message-search.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'filter/filter-message-search.c') diff --git a/filter/filter-message-search.c b/filter/filter-message-search.c index d374422dfd..b949fbd372 100644 --- a/filter/filter-message-search.c +++ b/filter/filter-message-search.c @@ -47,6 +47,7 @@ static ESExpResult *body_contains (struct _ESExp *f, int argc, struct _ESExpResu static ESExpResult *body_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); static ESExpResult *user_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); static ESExpResult *user_tag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); +static ESExpResult *system_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); static ESExpResult *get_sent_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); static ESExpResult *get_received_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); static ESExpResult *get_current_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms); @@ -73,6 +74,7 @@ static struct { { "header-full-regex", (ESExpFunc *) header_full_regex, 0 }, { "user-tag", (ESExpFunc *) user_tag, 0 }, { "user-flag", (ESExpFunc *) user_flag, 0 }, + { "system-flag", (ESExpFunc *) system_flag, 0 }, { "get-sent-date", (ESExpFunc *) get_sent_date, 0 }, { "get-received-date", (ESExpFunc *) get_received_date, 0 }, { "get-current-date", (ESExpFunc *) get_current_date, 0 }, @@ -663,6 +665,21 @@ user_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessage return r; } +static ESExpResult * +system_flag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) +{ + ESExpResult *r; + gboolean truth = FALSE; + + if (argc == 1) + truth = camel_system_flag_get (fms->info->flags, argv[0]->value.string); + + r = e_sexp_result_new (ESEXP_RES_BOOL); + r->value.bool = truth; + + return r; +} + static ESExpResult * user_tag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) { -- cgit v1.2.3