summaryrefslogtreecommitdiffstats
path: root/src/plugins/regexp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-04-15 17:01:01 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-04-15 17:01:01 +0400
commitd50dff03fdf56db4a24cf44e4e9eec70c69e81c3 (patch)
tree480a33e817a8bdcc66733f0712c101fd42c62947 /src/plugins/regexp.c
parent086e9da19d8ceaa605b1151c93b229a2e1040e79 (diff)
downloadrspamd-d50dff03fdf56db4a24cf44e4e9eec70c69e81c3.tar.gz
rspamd-d50dff03fdf56db4a24cf44e4e9eec70c69e81c3.zip
* For mime parts set flag 'raw' and if we cannot determine charset of part or cannot
encode it to utf8 just use for such parts raw regexps
Diffstat (limited to 'src/plugins/regexp.c')
-rw-r--r--src/plugins/regexp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index a05e0e0e0..fa9eafdd4 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -157,6 +157,7 @@ process_regexp (struct rspamd_regexp *re, struct worker_task *task)
char *headerv, *c, t;
struct mime_text_part *part;
GList *cur, *headerlist;
+ GRegex *regexp;
struct uri *url;
int r;
@@ -209,7 +210,13 @@ process_regexp (struct rspamd_regexp *re, struct worker_task *task)
cur = g_list_first (task->text_parts);
while (cur) {
part = (struct mime_text_part *)cur->data;
- if (g_regex_match_full (re->regexp, part->orig->data, part->orig->len, 0, 0, NULL, NULL) == TRUE) {
+ if (part->is_raw) {
+ regexp = re->raw_regexp;
+ }
+ else {
+ regexp = re->regexp;
+ }
+ if (g_regex_match_full (regexp, part->orig->data, part->orig->len, 0, 0, NULL, NULL) == TRUE) {
task_cache_add (task, re, 1);
return 1;
}