aboutsummaryrefslogtreecommitdiffstats
path: root/filter/filter-message-search.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-10-21 10:51:38 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-10-21 10:51:38 +0800
commit6d74595779416412b478dd4ae3d38dffd3f4baae (patch)
treef5793662a36daff8df54de77077193920fb5acc3 /filter/filter-message-search.c
parent3d17cca7ed57dcde3c6649e15d4ac7fe30174776 (diff)
downloadgsoc2013-evolution-6d74595779416412b478dd4ae3d38dffd3f4baae.tar
gsoc2013-evolution-6d74595779416412b478dd4ae3d38dffd3f4baae.tar.gz
gsoc2013-evolution-6d74595779416412b478dd4ae3d38dffd3f4baae.tar.bz2
gsoc2013-evolution-6d74595779416412b478dd4ae3d38dffd3f4baae.tar.lz
gsoc2013-evolution-6d74595779416412b478dd4ae3d38dffd3f4baae.tar.xz
gsoc2013-evolution-6d74595779416412b478dd4ae3d38dffd3f4baae.tar.zst
gsoc2013-evolution-6d74595779416412b478dd4ae3d38dffd3f4baae.zip
Added filter-url.[c,h].
2000-10-20 Jeffrey Stedfast <fejj@helixcode.com> * Makefile.am: Added filter-url.[c,h]. * filter-message-search.c (get_source): New callback to get the source url of the message being filtered. (filter_message_search): Now takes a source argument. * filter-element.c (filter_element_new_type_name): Added code to handle URL types. * filter-url.[c,h]: New filter object to handle URLs (ie in the case of filtering on source url). FIXME: find a way to populate the source combo box (including mail-config.h breaks the build in the addressbook - how does including mail-tools.h not break the build???) * filtertypes.xml: Added the source filter type and added the move-to action. * filter-driver.c (do_move): New callback, a "Copy" action should just copy the message to another location while a Move should both copy the message to a new location and delete it from the source location. (do_delete): Set the deleted flag on the message info. (filter_driver_filter_message): Now returns void as we don't care if it was copied or not in the caller functions. Also check the CamelMessageInfo being passed in - if the message has been marked as deleted prior to being filtered, then return immediately as we don't want to apply filter actions to deleted messages. svn path=/trunk/; revision=6094
Diffstat (limited to 'filter/filter-message-search.c')
-rw-r--r--filter/filter-message-search.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/filter/filter-message-search.c b/filter/filter-message-search.c
index 4f351b0829..8b90e273e6 100644
--- a/filter/filter-message-search.c
+++ b/filter/filter-message-search.c
@@ -27,6 +27,7 @@
typedef struct {
CamelMimeMessage *message;
CamelMessageInfo *info;
+ const char *source;
CamelException *ex;
} FilterMessageSearch;
@@ -40,6 +41,7 @@ static ESExpResult *get_sent_date (struct _ESExp *f, int argc, struct _ESExpResu
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);
+static ESExpResult *get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms);
/* builtin functions */
static struct {
@@ -56,7 +58,8 @@ static struct {
{ "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-score", (ESExpFunc *) get_score, 0 }
+ { "get-score", (ESExpFunc *) get_score, 0 },
+ { "get-source", (ESExpFunc *) get_source, 0 },
};
static ESExpResult *
@@ -337,8 +340,20 @@ get_score (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessage
return r;
}
+static ESExpResult *
+get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms)
+{
+ ESExpResult *r;
+
+ r = e_sexp_result_new (ESEXP_RES_STRING);
+ r->value.string = g_strdup (fms->source);
+
+ return r;
+}
+
gboolean
-filter_message_search (CamelMimeMessage *message, CamelMessageInfo *info, const char *expression, CamelException *ex)
+filter_message_search (CamelMimeMessage *message, CamelMessageInfo *info,
+ const char *source, const char *expression, CamelException *ex)
{
FilterMessageSearch *fms;
ESExp *sexp;
@@ -349,6 +364,7 @@ filter_message_search (CamelMimeMessage *message, CamelMessageInfo *info, const
fms = g_new (FilterMessageSearch, 1);
fms->message = message;
fms->info = info;
+ fms->source = source;
fms->ex = ex;
sexp = e_sexp_new ();