cd->composite = comp;
- rc = rspamd_process_expression (comp->expr, RSPAMD_EXPRESSION_FLAG_NOOPT, cd);
+ if (!isset (cd->checked, cd->composite->id * 2)) {
+ if (rspamd_symbols_cache_is_checked (cd->task, cd->task->cfg->cache,
+ key)) {
+ setbit (cd->checked, comp->id * 2);
+ clrbit (cd->checked, comp->id * 2 + 1);
+ }
+ else {
+ rc = rspamd_process_expression (comp->expr,
+ RSPAMD_EXPRESSION_FLAG_NOOPT, cd);
- /* Checked bit */
- setbit (cd->checked, comp->id * 2);
+ /* Checked bit */
+ setbit (cd->checked, comp->id * 2);
- /* Result bit */
- if (rc) {
- setbit (cd->checked, comp->id * 2 + 1);
- rspamd_task_insert_result_single (cd->task, key, 1.0, NULL);
- }
- else {
- clrbit (cd->checked, comp->id * 2 + 1);
+ /* Result bit */
+ if (rc) {
+ setbit (cd->checked, comp->id * 2 + 1);
+ rspamd_task_insert_result_single (cd->task, key, 1.0, NULL);
+ }
+ else {
+ clrbit (cd->checked, comp->id * 2 + 1);
+ }
+ }
}
}
return TRUE;
}
+
+gboolean
+rspamd_symbols_cache_is_checked (struct rspamd_task *task,
+ struct symbols_cache *cache, const gchar *symbol)
+{
+ gint id;
+ struct cache_savepoint *checkpoint;
+
+ g_assert (cache != NULL);
+ g_assert (symbol != NULL);
+
+ id = rspamd_symbols_cache_find_symbol_parent (cache, symbol);
+
+ if (id < 0) {
+ return FALSE;
+ }
+
+ checkpoint = task->checkpoint;
+
+ if (checkpoint) {
+ return isset (checkpoint->processed_bits, id * 2);
+ }
+
+ return FALSE;
+}
gboolean rspamd_symbols_cache_process_settings (struct rspamd_task *task,
struct symbols_cache *cache);
+
+/**
+ * Checks if a symbol specified has been checked (or disabled)
+ * @param task
+ * @param cache
+ * @param symbol
+ * @return
+ */
+gboolean rspamd_symbols_cache_is_checked (struct rspamd_task *task,
+ struct symbols_cache *cache, const gchar *symbol);
#endif