summaryrefslogtreecommitdiffstats
path: root/src/view.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-01-21 20:00:35 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-01-21 20:00:35 +0300
commitb0d0a4ce50733ce162ce9738da2d416497f98763 (patch)
tree2b6c99d4a8b4d15e87c6a93e7fbbc3347a93b5fd /src/view.c
parentb3633b1c36431980afe45b5a139ddefe4300f2fc (diff)
downloadrspamd-b0d0a4ce50733ce162ce9738da2d416497f98763.tar.gz
rspamd-b0d0a4ce50733ce162ce9738da2d416497f98763.zip
Add ability to include domains in views.
Diffstat (limited to 'src/view.c')
-rw-r--r--src/view.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/view.c b/src/view.c
index b24c26b28..24fbcf195 100644
--- a/src/view.c
+++ b/src/view.c
@@ -180,6 +180,7 @@ find_view_by_from (GList * views, struct worker_task *task)
GList *cur, *cur_re;
struct rspamd_view *v;
struct rspamd_regexp *re;
+ gchar *from_domain;
if (task->from == NULL) {
return NULL;
@@ -188,7 +189,14 @@ find_view_by_from (GList * views, struct worker_task *task)
cur = views;
while (cur) {
v = cur->data;
- /* First try to lookup in hashtable */
+ /* First try to lookup in hashtable domain name */
+ if ((from_domain = strchr (task->from, '@')) != NULL) {
+ from_domain ++;
+ if (g_hash_table_lookup (v->from_hash, from_domain) != NULL) {
+ msg_info ("found view for client from %s", task->from);
+ return v;
+ }
+ }
if (g_hash_table_lookup (v->from_hash, task->from) != NULL) {
msg_info ("found view for client from %s", task->from);
return v;