aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-filter-search.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-filter-search.c')
-rw-r--r--camel/camel-filter-search.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index 5396550d8f..b4651f67fc 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -73,6 +73,7 @@ static ESExpResult *get_received_date (struct _ESExp *f, int argc, struct _ESExp
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);
static ESExpResult *get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
+static ESExpResult *get_size (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
/* builtin functions */
static struct {
@@ -100,6 +101,7 @@ static struct {
{ "get-current-date", (ESExpFunc *) get_current_date, 0 },
{ "get-score", (ESExpFunc *) get_score, 0 },
{ "get-source", (ESExpFunc *) get_source, 0 },
+ { "get-size", (ESExpFunc *) get_size, 0 },
};
static ESExpResult *
@@ -407,6 +409,18 @@ get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessag
return r;
}
+/* remember, the size comparisons are done at Kbytes */
+static ESExpResult *
+get_size (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
+{
+ ESExpResult *r;
+
+ r = e_sexp_result_new(f, ESEXP_RES_INT);
+ r->value.number = fms->info->size / 1024;
+
+ return r;
+}
+
gboolean
camel_filter_search_match (CamelMimeMessage *message, CamelMessageInfo *info,
const char *source, const char *expression, CamelException *ex)