From b6ff168f955141b64a0ee73c7a919353a5e01f6e Mon Sep 17 00:00:00 2001 From: ketmar Date: Mon, 10 Jun 2024 11:04:16 +0000 Subject: [PATCH] receiver: better filter processing FossilOrigin-Name: 35ee81e5900179df029260a013e71b36753545f1ac133d2263ede227285b0954 --- receiver.d | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/receiver.d b/receiver.d index dea4b9c..778c37a 100644 --- a/receiver.d +++ b/receiver.d @@ -742,7 +742,11 @@ public void updateViewDB (bool skipFilters=false) { if (hlp.tag.length == 0) hlp.tag = "#hobo"; hlp.message = msg; // filter - foreach (auto row; dbConf.statement(`SELECT filterid AS filterid, name AS name, body AS body FROM filters ORDER BY idx;`).range) { + foreach (auto row; dbConf.statement( + `SELECT filterid AS filterid, name AS name, body AS body`~ + ` FROM filters`~ + ` WHERE valid<>0`~ + ` ORDER BY idx, filterid;`).range) { //conwrite(" filter '", row.name!SQ3Text, "' (", row.filterid!uint, "): "); bool goOn = false; hlp.matched = false; @@ -754,6 +758,9 @@ public void updateViewDB (bool skipFilters=false) { } if (hlp.matched) { conwriteln("...filter '", row.name!SQ3Text, "' matched!"); + dbConf.statement(`UPDATE filters SET hitcount=hitcount+1 WHERE filterid=:id`) + .bind(":id", row.filterid!uint) + .doAll(); } //hlp.writeResult(); writeln; //version(debug_filter_helper) writeln("::: <", row.body!SQ3Text, ">: goon=", goOn, "; isstop=", hlp.isStop); -- 2.11.4.GIT