aboutsummaryrefslogtreecommitdiffstats
path: root/filter
diff options
context:
space:
mode:
authorJon Trowbridge <trow@gnu.org>2001-04-14 06:08:03 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-04-14 06:08:03 +0800
commit0eb8afc1d0cfa27d020a4191f44e400c714d190c (patch)
treeb3629148572fa1f1ee1982e8359faed15245d74b /filter
parent546128c8d99b1edd859ba5d8b57549550b910a1d (diff)
downloadgsoc2013-evolution-0eb8afc1d0cfa27d020a4191f44e400c714d190c.tar.gz
gsoc2013-evolution-0eb8afc1d0cfa27d020a4191f44e400c714d190c.tar.zst
gsoc2013-evolution-0eb8afc1d0cfa27d020a4191f44e400c714d190c.zip
Make the (previously unused) get-source command actually do the right
2001-04-13 Jon Trowbridge <trow@gnu.org> * camel-filter-search.c (get_source): Make the (previously unused) get-source command actually do the right thing, properly shrouding any passed-in source and falling back to use the source attached to the mime message. 2001-04-13 Jon Trowbridge <trow@gnu.org> * filtertypes.xml: Add XML specs for source account filtering. * filter-element.c (filter_element_new_type_name): Recognize type "source", construct a FilterSource. * filter-source.c: Added. A FilterElement for the account e-mail comes from. svn path=/trunk/; revision=9304
Diffstat (limited to 'filter')
-rw-r--r--filter/ChangeLog10
-rw-r--r--filter/Makefile.am2
-rw-r--r--filter/filter-element.c3
-rw-r--r--filter/filter-part.c4
-rw-r--r--filter/filter-rule.c4
-rw-r--r--filter/filtertypes.xml19
-rw-r--r--filter/libfilter-i18n.h3
7 files changed, 42 insertions, 3 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index eec01c7c2c..678dd455f8 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,13 @@
+2001-04-13 Jon Trowbridge <trow@gnu.org>
+
+ * filtertypes.xml: Add XML specs for source account filtering.
+
+ * filter-element.c (filter_element_new_type_name): Recognize
+ type "source", construct a FilterSource.
+
+ * filter-source.c: Added. A FilterElement for the account e-mail
+ comes from.
+
2001-04-04 Kjartan Maraas <kmaraas@gnome.org>
* filter-editor.c: Fix headers.
diff --git a/filter/Makefile.am b/filter/Makefile.am
index ba3afe8240..e1245f599b 100644
--- a/filter/Makefile.am
+++ b/filter/Makefile.am
@@ -49,6 +49,8 @@ libfilter_la_SOURCES = \
filter-rule.h \
filter-score.c \
filter-score.h \
+ filter-source.h \
+ filter-source.c \
rule-context.c \
rule-context.h \
rule-editor.c \
diff --git a/filter/filter-element.c b/filter/filter-element.c
index dd7a7167bb..7aa3b654d6 100644
--- a/filter/filter-element.c
+++ b/filter/filter-element.c
@@ -33,6 +33,7 @@
#include "filter-datespec.h"
#include "filter-score.h"
#include "filter-folder.h"
+#include "filter-source.h"
static gboolean validate (FilterElement *fe);
@@ -266,6 +267,8 @@ filter_element_new_type_name (const char *type)
return (FilterElement *)filter_score_new ();
} else if (!strcmp (type, "regex")) {
return (FilterElement *)filter_input_new_type_name (type);
+ } else if (!strcmp (type, "source")) {
+ return (FilterElement *)filter_source_new ();
} else {
g_warning("Unknown filter type '%s'", type);
return 0;
diff --git a/filter/filter-part.c b/filter/filter-part.c
index 6e7fc7fc2c..c4cc6888b9 100644
--- a/filter/filter-part.c
+++ b/filter/filter-part.c
@@ -157,7 +157,7 @@ filter_part_xml_create (FilterPart *ff, xmlNodePtr node)
&& (el = filter_element_new_type_name (type)) != NULL) {
filter_element_xml_create (el, n);
xmlFree (type);
- d(printf ("adding element part %p %s\n", el, el->name));
+ d(printf ("adding element part %p %s\n", ff, el, el->name));
ff->elements = g_list_append (ff->elements, el);
} else {
g_warning ("Invalid xml format, missing/unknown input type");
@@ -432,7 +432,7 @@ filter_part_expand_code (FilterPart *ff, const char *source, GString *out)
memcpy (name, newstart+2, len);
name[len] = 0;
fe = filter_part_find_element (ff, name);
- d(printf("expand code: looking up variab le '%s' = %p\n", name, fe));
+ d(printf("expand code: looking up variab le '%s' = %p\n", ff, name, fe));
if (fe) {
g_string_sprintfa (out, "%.*s", newstart-start, start);
filter_element_format_sexp (fe, out);
diff --git a/filter/filter-rule.c b/filter/filter-rule.c
index bb21484218..10d583b58a 100644
--- a/filter/filter-rule.c
+++ b/filter/filter-rule.c
@@ -387,7 +387,9 @@ filter_rule_build_code (FilterRule *fr, GString *out)
g_assert(IS_FILTER_RULE(fr));
g_assert(out != NULL);
- return ((FilterRuleClass *) ((GtkObject *) fr)->klass)->build_code(fr, out);
+ ((FilterRuleClass *) ((GtkObject *) fr)->klass)->build_code(fr, out);
+
+ g_message ("build_code: [%s](%d)", out->str, out->len);
}
static void
diff --git a/filter/filtertypes.xml b/filter/filtertypes.xml
index 7b168afe8c..aa2b9bbbfa 100644
--- a/filter/filtertypes.xml
+++ b/filter/filtertypes.xml
@@ -533,6 +533,25 @@
<input type="regex" name="expression"/>
</part>
+ <part name="source">
+ <title>Source Account</title>
+ <input type="optionlist" name="srcmatch-type">
+ <option value="is">
+ <title>Is</title>
+ <code>
+ (match-all (= (get-source) ${uri}))
+ </code>
+ </option>
+ <option value="is-not">
+ <title>Is Not</title>
+ <code>
+ (match-all (not (= (get-source) ${uri})))
+ </code>
+ </option>
+ </input>
+ <input type="source" name="uri"/>
+ </part>
+
</partset>
diff --git a/filter/libfilter-i18n.h b/filter/libfilter-i18n.h
index e561ee8071..bd237f3337 100644
--- a/filter/libfilter-i18n.h
+++ b/filter/libfilter-i18n.h
@@ -13,6 +13,8 @@ char *s = N_("Exist");
char *s = N_("Expression");
char *s = N_("Forward to Address");
char *s = N_("Important");
+char *s = N_("Is Not");
+char *s = N_("Is");
char *s = N_("Mailing list");
char *s = N_("Message Body");
char *s = N_("Message Header");
@@ -26,6 +28,7 @@ char *s = N_("Replied to");
char *s = N_("Score");
char *s = N_("Sender");
char *s = N_("Set Status");
+char *s = N_("Source Account");
char *s = N_("Specific header");
char *s = N_("Status");
char *s = N_("Stop Processing");