]> source.dussan.org Git - rspamd.git/commitdiff
* Fix 'cc' urls parsing
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 16 Jul 2009 13:30:03 +0000 (17:30 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Thu, 16 Jul 2009 13:30:03 +0000 (17:30 +0400)
* Add function has_fake_html for determine fake html parts (without any tags)

src/expressions.c
src/url.c

index 13b426ec7dca2b5a7ddeed70685767b2a0e4b239..9b3b9bf2ffd7e9a543eee2eb83e01dd2623523cd 100644 (file)
@@ -46,6 +46,7 @@ gboolean rspamd_is_recipients_sorted (struct worker_task *task, GList *args);
 gboolean rspamd_compare_transfer_encoding (struct worker_task *task, GList *args);
 gboolean rspamd_is_html_balanced (struct worker_task *task, GList *args);
 gboolean rspamd_has_html_tag (struct worker_task *task, GList *args);
+gboolean rspamd_has_fake_html (struct worker_task *task, GList *args);
 
 /*
  * List of internal functions of rspamd
@@ -65,6 +66,7 @@ static struct _fl {
        { "content_type_is_type", rspamd_content_type_is_type },
        { "has_content_part", rspamd_has_content_part },
        { "has_content_part_len", rspamd_has_content_part_len },
+       { "has_fake_html", rspamd_has_fake_html },
        { "has_html_tag", rspamd_has_html_tag },
        { "has_only_html_part", rspamd_has_only_html_part },
        { "header_exists", rspamd_header_exists },
@@ -1606,6 +1608,28 @@ rspamd_has_html_tag (struct worker_task *task, GList *args)
 
 }
 
+gboolean 
+rspamd_has_fake_html (struct worker_task *task, GList *args)
+{
+       struct mime_text_part *p;
+       GList *cur;
+       gboolean res = FALSE;
+       
+       cur = g_list_first (task->text_parts);
+
+       while (cur && res == FALSE) {
+               p = cur->data;
+               if (p->is_html && p->html_nodes == NULL) {
+                       res = TRUE;
+               }
+               cur = g_list_next (cur);
+       }
+
+       return res;
+
+}
+
+
 /*
  * vi:ts=4
  */
index e156960c3d5ae85070a12a5fda2a0438e51f6c6b..6f17f1a6dca97544e84705fe18e9d55f6d41b07c 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -53,7 +53,7 @@ static const char *text_url = "((https?|ftp)://)?"
 "(\\b(?<![.\\@A-Za-z0-9-])"    
 "(?: [A-Za-z0-9][A-Za-z0-9-]*(?:\\.[A-Za-z0-9-]+)*\\."
 "(?i:com|net|org|biz|edu|gov|info|name|int|mil|aero|coop|jobs|mobi|museum|pro|travel"
-"|[rs]u|uk|ua|by|de|jp|fr|fi|no|no|ca|it|ro|cn|nl|at|nu|se"
+"|cc|[rs]u|uk|ua|by|de|jp|fr|fi|no|no|ca|it|ro|cn|nl|at|nu|se"
 "|[a-z]{2}"
 "(?(1)|(?=/)))"
 "(?!\\w)"