diff options
-rw-r--r-- | filter/ChangeLog | 10 | ||||
-rw-r--r-- | filter/filter-message-search.c | 9 | ||||
-rw-r--r-- | filter/vfoldertypes.xml | 119 |
3 files changed, 132 insertions, 6 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index 2b5c4ab9a3..671960400c 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,13 @@ +2000-12-21 Jeffrey Stedfast <fejj@helixcode.com> + + * filter-message-search.c (header_contains): Use + e_utf8_strstrcase() instead of just strstr(). + (header_starts_with): Make sure that the header contents are + longer than the starts-with string. + + * vfoldertypes.xml: Don't send \"Subject\" to body-contains. + Also added matches, starts-with, and ends-with xml stuff. + 2000-12-28 Dan Winship <danw@helixcode.com> * filter-message-search.c (handle_multipart, body_contains, diff --git a/filter/filter-message-search.c b/filter/filter-message-search.c index cdfe64f2ae..4aee0dfdbd 100644 --- a/filter/filter-message-search.c +++ b/filter/filter-message-search.c @@ -21,6 +21,7 @@ */ #include "filter-message-search.h" +#include <gal/widgets/e-unicode.h> #include <e-util/e-sexp.h> #include <regex.h> #include <string.h> @@ -96,7 +97,7 @@ header_contains (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterM contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header); if (contents) { - if (strstr (contents, match)) + if (e_utf8_strstrcase (contents, match)) matched = TRUE; } } @@ -167,7 +168,7 @@ header_starts_with (struct _ESExp *f, int argc, struct _ESExpResult **argv, Filt contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), header); - if (contents) { + if (contents && strlen (contents) >= strlen (match)) { /* danw says to use search-engine style matching... * This means that if the search match string is * lowercase then compare case-insensitive else @@ -695,7 +696,7 @@ user_tag (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageS } static ESExpResult * -get_sent_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) +get_sent_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) { ESExpResult *r; @@ -706,7 +707,7 @@ get_sent_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMess } static ESExpResult * -get_received_date(struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) +get_received_date (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessageSearch *fms) { ESExpResult *r; diff --git a/filter/vfoldertypes.xml b/filter/vfoldertypes.xml index 84d06964c4..36157e6ffc 100644 --- a/filter/vfoldertypes.xml +++ b/filter/vfoldertypes.xml @@ -12,9 +12,42 @@ <title>does not contain</title> <code>(match-all (not (header-contains "From" ${sender})))</code> </option> + <option value="is"> + <title>is</title> + <code>(match-all (header-matches "From" ${sender}))</code> + </option> + <option value="is not"> + <title>is not</title> + <code>(match-all (not (header-matches "From" ${sender})))</code> + </option> + <option value="starts with"> + <title>starts with</title> + <code> + (match-all (header-starts-with "From" ${sender})) + </code> + </option> + <option value="not starts with"> + <title>does not start with</title> + <code> + (match-all (not (header-starts-with "From" ${sender}))) + </code> + </option> + <option value="ends with"> + <title>ends with</title> + <code> + (match-all (header-ends-with "From" ${sender})) + </code> + </option> + <option value="not ends with"> + <title>does not end with</title> + <code> + (match-all (not (header-ends-with "From" ${sender}))) + </code> + </option> </input> <input type="string" name="sender"/> </part> + <part name="to"> <title>Recipients</title> <input type="optionlist" name="recipient-type"> @@ -33,9 +66,55 @@ (header-contains "Cc" ${recipient})))) </code> </option> + <option value="is"> + <title>is</title> + <code> + (match-all (or (header-matches "To" ${recipient}) + (header-matches "Cc" ${recipient}))) + </code> + </option> + <option value="is not"> + <title>is not</title> + <code> + (match-all (not (or + (header-matches "To" ${recipient}) + (header-matches "Cc" ${recipient})))) + </code> + </option> + <option value="starts with"> + <title>starts with</title> + <code> + (match-all (or (header-starts-with "To" ${recipient}) + (header-starts-with "Cc" ${recipient}))) + </code> + </option> + <option value="not starts with"> + <title>does not start with</title> + <code> + (match-all (not (or + (header-starts-with "To" ${recipient}) + (header-starts-with "Cc" ${recipient})))) + </code> + </option> + <option value="ends with"> + <title>ends with</title> + <code> + (match-all (or (header-ends-with "To" ${recipient}) + (header-ends-with "Cc" ${recipient}))) + </code> + </option> + <option value="not ends with"> + <title>does not end with</title> + <code> + (match-all (not (or + (header-ends-with "To" ${recipient}) + (header-ends-with "Cc" ${recipient})))) + </code> + </option> </input> <input type="address" name="recipient"/> </part> + <part name="subject"> <title>Subject</title> <input type="optionlist" name="subject-type"> @@ -51,6 +130,42 @@ (match-all (not (header-contains "Subject" ${subject}))) </code> </option> + <option value="is"> + <title>is</title> + <code> + (match-all (header-matches "Subject" ${subject})) + </code> + </option> + <option value="is not"> + <title>is not</title> + <code> + (match-all (not (header-matches "Subject" ${subject})) + </code> + </option> + <option value="starts with"> + <title>starts with</title> + <code> + (match-all (header-starts-with "Subject" ${subject})) + </code> + </option> + <option value="not starts with"> + <title>does not start with</title> + <code> + (match-all (not (header-starts-with "Subject" ${subject})) + </code> + </option> + <option value="ends with"> + <title>ends with</title> + <code> + (match-all (header-ends-with "Subject" ${subject})) + </code> + </option> + <option value="not ends with"> + <title>does not end with</title> + <code> + (match-all (not (header-ends-with "Subject" ${subject})) + </code> + </option> </input> <input type="string" name="subject"/> </part> @@ -66,7 +181,7 @@ <option value="not contains"> <title>does not contain</title> <code> - (not (body-contains "Subject" ${word})) + (not (body-contains ${word})) </code> </option> </input> @@ -136,7 +251,7 @@ (match-all (not (< (get-received-date) ${versus}))) </code> </option> - </input> + </input> <input type="datespec" name="versus"> </input> </part> |