task->pre_result.action = METRIC_ACTION_REJECT;
task->pre_result.str = "Gtube pattern";
+ ucl_object_insert_key (task->messages,
+ ucl_object_fromstring ("Gtube pattern"), "smtp_message", 0,
+ false);
rspamd_task_insert_result (task, GTUBE_SYMBOL, 0, NULL);
return;
ucl_object_insert_key (top, obj, h, 0, false);
}
- if (task->messages != NULL) {
- ucl_object_insert_key (top, rspamd_str_list_ucl (
- task->messages), "messages", 0, false);
- }
+ ucl_object_insert_key (top, ucl_object_ref (task->messages),
+ "messages", 0, false);
if (task->cfg->log_urls || (task->flags & RSPAMD_TASK_FLAG_EXT_URLS)) {
if (g_hash_table_size (task->urls) > 0) {
new_task->pre_result.action = METRIC_ACTION_MAX;
new_task->message_id = new_task->queue_id = "undef";
+ new_task->messages = ucl_object_typed_new (UCL_OBJECT);
return new_task;
}
rspamd_email_address_unref (task->from_envelope);
}
- if (task->messages) {
- g_list_free (task->messages);
- }
+ ucl_object_unref (task->messages);
if (task->http_conn != NULL) {
rspamd_http_connection_reset (task->http_conn);
struct rspamd_email_address *from_envelope;
enum rspamd_newlines_type nlines_type; /**< type of newlines (detected on most of headers */
- GList *messages; /**< list of messages that would be reported */
+ ucl_object_t *messages; /**< list of messages that would be reported */
struct rspamd_re_runtime *re_rt; /**< regexp runtime */
GPtrArray *stat_runtimes; /**< backend runtime */
struct rspamd_config *cfg; /**< pointer to config object */
action_str = rspamd_mempool_strdup (task->task_pool,
luaL_checkstring (L, 3));
task->pre_result.str = action_str;
- task->messages = g_list_prepend (task->messages, action_str);
+ ucl_object_insert_key (task->messages,
+ ucl_object_fromstring (action_str), "smtp_message", 0,
+ false);
}
else {
task->pre_result.str = "unknown";
lua_task_append_message (lua_State * L)
{
struct rspamd_task *task = lua_check_task (L, 1);
- gchar *message;
+ const gchar *message = luaL_checkstring (L, 2), *category;
if (task != NULL) {
- message= rspamd_mempool_strdup (task->task_pool,
- luaL_checkstring (L, 2));
- task->messages = g_list_prepend (task->messages, message);
+ if (lua_type (L, 3) == LUA_TSTRING) {
+ category = luaL_checkstring (L, 3);
+ }
+ else {
+ category = "unknown";
+ }
+
+ ucl_object_insert_key (task->messages,
+ ucl_object_fromstring (message), category, 0,
+ true);
}
else {
return luaL_error (L, "invalid arguments");
spf_symbol,
1,
opts);
- task->messages = g_list_prepend (task->messages, (gpointer)spf_message);
+ ucl_object_insert_key (task->messages,
+ ucl_object_fromstring (spf_message), "spf", 0,
+ false);
+
return TRUE;
}