aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog7
-rw-r--r--camel/camel-filter-search.c17
-rw-r--r--camel/camel-internet-address.c2
-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
10 files changed, 64 insertions, 7 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 7b2d2fa8d3..8e8d303b82 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,10 @@
+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 Dan Winship <danw@ximian.com>
* camel-object.c (camel_object_hook_event):
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index 15e8eb77f2..78f4ee7b4c 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -35,6 +35,7 @@
#include <ctype.h>
#include "e-util/e-sexp.h"
+#include "e-util/e-url.h"
#include "camel-mime-message.h"
#include "camel-filter-search.h"
@@ -397,13 +398,20 @@ get_source (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessag
ESExpResult *r;
r = e_sexp_result_new(f, ESEXP_RES_STRING);
- r->value.string = g_strdup (fms->source);
+ if (fms->source) {
+ r->value.string = e_url_shroud (fms->source);
+ } else {
+ r->value.string = camel_mime_message_get_source (fms->message);
+ }
+
+ g_message ("got source: [%s]", r->value.string);
return r;
}
-gboolean camel_filter_search_match(CamelMimeMessage *message, CamelMessageInfo *info,
- const char *source, const char *expression, CamelException *ex)
+gboolean
+camel_filter_search_match(CamelMimeMessage *message, CamelMessageInfo *info,
+ const char *source, const char *expression, CamelException *ex)
{
FilterMessageSearch fms;
ESExp *sexp;
@@ -452,3 +460,6 @@ error:
e_sexp_unref(sexp);
return FALSE;
}
+
+
+
diff --git a/camel/camel-internet-address.c b/camel/camel-internet-address.c
index 416451b27d..902178c303 100644
--- a/camel/camel-internet-address.c
+++ b/camel/camel-internet-address.c
@@ -24,7 +24,7 @@
#include "camel-mime-utils.h"
#include "camel-internet-address.h"
-#define d(x)
+#define d(x)
static int internet_decode (CamelAddress *, const char *raw);
static char * internet_encode (CamelAddress *);
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");