aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author3 <NotZed@Ximian.com>2001-10-04 06:17:10 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-04 06:17:10 +0800
commit1ecc7068f5ccec30e1e99fc7193c26993496797a (patch)
treed4d1ed00db8f2be8dc4a28d2a79706dddacc9813
parent628b33f28c29f843232471e79347c10af5a9c413 (diff)
downloadgsoc2013-evolution-1ecc7068f5ccec30e1e99fc7193c26993496797a.tar.gz
gsoc2013-evolution-1ecc7068f5ccec30e1e99fc7193c26993496797a.tar.zst
gsoc2013-evolution-1ecc7068f5ccec30e1e99fc7193c26993496797a.zip
Added MATCH_NEWLINE flag, -> REG_NEWLINE.
2001-10-03 <NotZed@Ximian.com> * camel-search-private.c (camel_search_build_match_regex): Added MATCH_NEWLINE flag, -> REG_NEWLINE. * camel-lock-helper.c: Include <string.h> to kill some warnings. * camel-filter-search.c (get_full_header): Put \n's between each line we generate. (header_full_regex): Dont drop the first argument to the command -> empty matches! (header_full_regex): Set match_newline for building regex. (body_regex): And here too. These all fix #9877. svn path=/trunk/; revision=13392
-rw-r--r--camel/ChangeLog14
-rw-r--r--camel/camel-filter-search.c13
-rw-r--r--camel/camel-lock-helper.c2
-rw-r--r--camel/camel-search-private.c2
-rw-r--r--camel/camel-search-private.h1
5 files changed, 25 insertions, 7 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index f04abc03f1..bd836e916f 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,17 @@
+2001-10-03 <NotZed@Ximian.com>
+
+ * camel-search-private.c (camel_search_build_match_regex): Added
+ MATCH_NEWLINE flag, -> REG_NEWLINE.
+
+ * camel-lock-helper.c: Include <string.h> to kill some warnings.
+
+ * camel-filter-search.c (get_full_header): Put \n's between each
+ line we generate.
+ (header_full_regex): Dont drop the first argument to the command
+ -> empty matches!
+ (header_full_regex): Set match_newline for building regex.
+ (body_regex): And here too. These all fix #9877.
+
2001-10-03 Jeffrey Stedfast <fejj@ximian.com>
* camel-store.c (camel_store_delete_folder): Call
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index 49ece8704a..45aec201e5 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -206,9 +206,7 @@ header_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMess
if (argc > 1 && argv[0]->type == ESEXP_RES_STRING
&& (contents = camel_medium_get_header (CAMEL_MEDIUM (fms->message), argv[0]->value.string))
- && camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_REGEX |
- CAMEL_SEARCH_MATCH_ICASE, argc-1, argv+1,
- fms->ex) == 0) {
+ && camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE, argc-1, argv+1, fms->ex) == 0) {
r->value.bool = regexec (&pattern, contents, 0, NULL, 0) == 0;
regfree (&pattern);
} else
@@ -233,6 +231,7 @@ get_full_header (CamelMimeMessage *message)
else
g_string_append (str, ": ");
g_string_append (str, h->value);
+ g_string_append_c(str, '\n');
}
}
@@ -249,8 +248,8 @@ header_full_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, Filte
regex_t pattern;
char *contents;
- if (camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_REGEX |
- CAMEL_SEARCH_MATCH_ICASE, argc-1, argv+1, fms->ex) == 0) {
+ if (camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_ICASE|CAMEL_SEARCH_MATCH_NEWLINE,
+ argc, argv, fms->ex) == 0) {
contents = get_full_header (fms->message);
r->value.bool = regexec (&pattern, contents, 0, NULL, 0) == 0;
g_free (contents);
@@ -297,8 +296,8 @@ body_regex (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessag
ESExpResult *r = e_sexp_result_new(f, ESEXP_RES_BOOL);
regex_t pattern;
- if (camel_search_build_match_regex (&pattern, CAMEL_SEARCH_MATCH_ICASE |
- CAMEL_SEARCH_MATCH_REGEX, argc, argv, fms->ex) == 0) {
+ if (camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_ICASE|CAMEL_SEARCH_MATCH_REGEX|CAMEL_SEARCH_MATCH_NEWLINE,
+ argc, argv, fms->ex) == 0) {
r->value.bool = camel_search_message_body_contains ((CamelDataWrapper *)fms->message, &pattern);
regfree (&pattern);
} else
diff --git a/camel/camel-lock-helper.c b/camel/camel-lock-helper.c
index 7cb381eae0..1c52386208 100644
--- a/camel/camel-lock-helper.c
+++ b/camel/camel-lock-helper.c
@@ -39,6 +39,8 @@
#include <time.h>
+#include <string.h>
+
#define SETEUID_SAVES (1)
/* we try and include as little as possible */
diff --git a/camel/camel-search-private.c b/camel/camel-search-private.c
index 759ca7cf3e..e392d79417 100644
--- a/camel/camel-search-private.c
+++ b/camel/camel-search-private.c
@@ -99,6 +99,8 @@ camel_search_build_match_regex (regex_t *pattern, camel_search_flags_t type, int
flags = REG_EXTENDED|REG_NOSUB;
if (type & CAMEL_SEARCH_MATCH_ICASE)
flags |= REG_ICASE;
+ if (type & CAMEL_SEARCH_MATCH_NEWLINE)
+ flags |= REG_NEWLINE;
err = regcomp (pattern, match->str, flags);
if (err != 0) {
/* regerror gets called twice to get the full error string
diff --git a/camel/camel-search-private.h b/camel/camel-search-private.h
index ac88dd7257..fdfe977a29 100644
--- a/camel/camel-search-private.h
+++ b/camel/camel-search-private.h
@@ -26,6 +26,7 @@ typedef enum {
CAMEL_SEARCH_MATCH_END = 1<<1,
CAMEL_SEARCH_MATCH_REGEX = 1<<2, /* disables the first 2 */
CAMEL_SEARCH_MATCH_ICASE = 1<<3,
+ CAMEL_SEARCH_MATCH_NEWLINE = 1<<4,
} camel_search_flags_t;
typedef enum {