aboutsummaryrefslogtreecommitdiffstats
path: root/filter/filter-message-search.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-09-09 04:36:14 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-09-09 04:36:14 +0800
commitf9d0db03faef147752790fe0d0e254b954776b61 (patch)
tree33114754b5ffd27211005757ad9206fbc10663c3 /filter/filter-message-search.c
parente114c6fb58935bc406438bc69b7f53febf0c7e16 (diff)
downloadgsoc2013-evolution-f9d0db03faef147752790fe0d0e254b954776b61.tar
gsoc2013-evolution-f9d0db03faef147752790fe0d0e254b954776b61.tar.gz
gsoc2013-evolution-f9d0db03faef147752790fe0d0e254b954776b61.tar.bz2
gsoc2013-evolution-f9d0db03faef147752790fe0d0e254b954776b61.tar.lz
gsoc2013-evolution-f9d0db03faef147752790fe0d0e254b954776b61.tar.xz
gsoc2013-evolution-f9d0db03faef147752790fe0d0e254b954776b61.tar.zst
gsoc2013-evolution-f9d0db03faef147752790fe0d0e254b954776b61.zip
Added scoring xml stuffs
2000-09-08 Jeffrey Stedfast <fejj@helixcode.com> * 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
Diffstat (limited to 'filter/filter-message-search.c')
-rw-r--r--filter/filter-message-search.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/filter/filter-message-search.c b/filter/filter-message-search.c
index 4fad81cdf5..9730deb61e 100644
--- a/filter/filter-message-search.c
+++ b/filter/filter-message-search.c
@@ -40,7 +40,7 @@ static ESExpResult *user_tag (struct _ESExp *f, int argc, struct _ESExpResult **
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);
-
+static ESExpResult *get_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
/* builtin functions */
static struct {
@@ -56,7 +56,8 @@ static struct {
{ "user-flag", (ESExpFunc *) user_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 }
+ { "get-current-date", (ESExpFunc *) get_current_date, 0 },
+ { "get-score", (ESExpFunc *) get_score, 0 }
};
static ESExpResult *
@@ -224,12 +225,26 @@ static ESExpResult *
get_current_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
{
ESExpResult *r;
- time_t date;
- date = time (NULL);
+ r = e_sexp_result_new (ESEXP_RES_INT);
+ r->value.number = time (NULL);
+
+ return r;
+}
+
+static ESExpResult *
+get_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
+{
+ ESExpResult *r;
+ const char *tag;
+
+ tag = camel_tag_get (&fms->info->user_tags, "score");
r = e_sexp_result_new (ESEXP_RES_INT);
- r->value.number = date;
+ if (tag)
+ r->value.number = atoi (tag);
+ else
+ r->value.number = 0;
return r;
}