diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-05-10 22:52:01 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-05-10 22:52:01 +0400 |
commit | bc953ee7602b6a4278fc5c13a83ad570444f5cc6 (patch) | |
tree | d5f2c84460ffb9b838baccd5a315bfad04832d0f /src/settings.c | |
parent | c29b6dc179123cdb7b47cb12b6c3bd7a2d053994 (diff) | |
download | rspamd-bc953ee7602b6a4278fc5c13a83ad570444f5cc6.tar.gz rspamd-bc953ee7602b6a4278fc5c13a83ad570444f5cc6.zip |
* Add Subject header that indicate how Subject must be rewritten in case of 'rewrite subject' action
Fix initialization order of json settings.
Diffstat (limited to 'src/settings.c')
-rw-r--r-- | src/settings.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/settings.c b/src/settings.c index af4c37b80..8d18880a0 100644 --- a/src/settings.c +++ b/src/settings.c @@ -229,27 +229,25 @@ json_fin_cb (memory_pool_t * pool, struct map_cb_data *data) act_value = json_object_iter_value (act_it); if (act_value && json_is_number (act_value)) { - if (check_action_str (json_object_iter_key (act_it), &j)) { + /* Special cases */ + if (g_ascii_strcasecmp (json_object_iter_key (act_it), "spam_score") == 0) { + score = g_malloc (sizeof (double)); + *score = json_number_value (act_value); + g_hash_table_insert (cur_settings->metric_scores, + g_strdup (json_object_iter_key (json_it)), score); + } + else if (g_ascii_strcasecmp (json_object_iter_key (act_it), "reject_score") == 0) { + score = g_malloc (sizeof (double)); + *score = json_number_value (act_value); + g_hash_table_insert (cur_settings->reject_scores, + g_strdup (json_object_iter_key (json_it)), score); + } + else if (check_action_str (json_object_iter_key (act_it), &j)) { new_act = g_malloc (sizeof (struct metric_action)); new_act->action = j; new_act->score = json_number_value (act_value); cur_act = g_list_prepend (cur_act, new_act); } - else { - /* Special cases */ - if (g_ascii_strcasecmp (json_object_iter_key (act_it), "spam_score") == 0) { - score = g_malloc (sizeof (double)); - *score = json_number_value (act_value); - g_hash_table_insert (cur_settings->metric_scores, - g_strdup (json_object_iter_key (json_it)), score); - } - else if (g_ascii_strcasecmp (json_object_iter_key (act_it), "reject_score") == 0) { - score = g_malloc (sizeof (double)); - *score = json_number_value (act_value); - g_hash_table_insert (cur_settings->reject_scores, - g_strdup (json_object_iter_key (json_it)), score); - } - } } act_it = json_object_iter_next (it_val, act_it); } |