--- /dev/null
+-- 0 or 1 received: = spam
+
+local metric = 'default'
+local symbol = 'ONCE_RECEIVED'
+
+function check_quantity_received (task)
+ local recvh = task:get_received_headers()
+ if table.maxn(recvh) <= 1 then
+ task:insert_result(metric, symbol, 1)
+ end
+end
+
+-- Register symbol's callback
+local m = rspamd_config:get_metric(metric)
+m:register_symbol(symbol, 1.0, 'check_quantity_received')
task->state = WRITE_ERROR;
}
if (task->state == WRITE_REPLY || task->state == WRITE_ERROR) {
- write_socket (task);
+ return write_socket (task);
}
break;
case READ_MESSAGE:
task->last_error = "MIME processing error";
task->error_code = RSPAMD_FILTER_ERROR;
task->state = WRITE_ERROR;
- write_socket (task);
+ return write_socket (task);
}
if (task->cmd == CMD_OTHER) {
/* Skip filters */
task->state = WRITE_REPLY;
- write_socket (task);
- return TRUE;
+ return write_socket (task);
}
r = process_filters (task);
if (r == -1) {
task->last_error = "Filter processing error";
task->error_code = RSPAMD_FILTER_ERROR;
task->state = WRITE_ERROR;
- write_socket (task);
+ return write_socket (task);
}
else if (r == 0) {
task->state = WAIT_FILTER;
}
else {
process_statfiles (task);
- write_socket (task);
+ return write_socket (task);
}
break;
default: