From 4b883177dc025db24473e62469f97631a12ad536 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Fri, 1 Jan 2021 20:09:10 -0500 Subject: Split ignore fields to avoid over-eager * matching Split ignore fields and match each separately to avoid an early * eagerly matching across several fields. For example, "* JOIN * *" should not match messages which happen to contain the word "JOIN" followed by two other words. Ignore capacity is reduced to 64 to keep the size of the array the same. I don't think it's an issue. --- chat.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'chat.h') diff --git a/chat.h b/chat.h index c7af680..b06d383 100644 --- a/chat.h +++ b/chat.h @@ -353,13 +353,16 @@ void urlOpenCount(uint id, uint count); void urlOpenMatch(uint id, const char *str); void urlCopyMatch(uint id, const char *str); -enum { IgnoreCap = 256 }; +enum { IgnoreCap = 64 }; extern struct Ignore { - size_t len; - char *patterns[IgnoreCap]; -} ignore; -const char *ignoreAdd(const char *pattern); -bool ignoreRemove(const char *pattern); + char *mask; + char *cmd; + char *chan; + char *mesg; +} ignores[IgnoreCap]; +struct Ignore ignoreParse(char *pattern); +struct Ignore ignoreAdd(const char *pattern); +bool ignoreRemove(struct Ignore ignore); enum Heat ignoreCheck(enum Heat heat, uint id, const struct Message *msg); extern bool logEnable; -- cgit 1.4.1