From a12b2a8c08ef2745715c518d5d222c3c696102f4 Mon Sep 17 00:00:00 2001 From: antiwinter Date: Sat, 4 Jan 2020 10:24:15 +0800 Subject: [PATCH] add option to blacklist msg from the searched msg --- main.lua | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/main.lua b/main.lua index 9a342c9..ee3da30 100644 --- a/main.lua +++ b/main.lua @@ -143,15 +143,26 @@ local function SearchMessage(msg, from, source) local fstart, fend; for _, data in pairs(CChatNotifier_data) do if data.active then + local black = false for _, search in ipairs(data.words) do - fstart, fend = string.find(msglow, search); - if fstart ~= nil then - local nameNoDash = RemoveServerDash(from); - if nameNoDash == playerName then + if (search:sub(1,1) == '-') then + fstart, fend = string.find(msglow, search:sub(2)); + if fstart ~= nil then + black = true + end + end + end + if (not black) then + for _, search in ipairs(data.words) do + fstart, fend = string.find(msglow, search); + if fstart ~= nil then + local nameNoDash = RemoveServerDash(from); + if nameNoDash == playerName then + return; + end + _addon:PostNotification(_addon:FormNotifyMsg(search, source, from, msg, fstart, fend), CChatNotifier_settings.chatFrame); return; end - _addon:PostNotification(_addon:FormNotifyMsg(search, source, from, msg, fstart, fend), CChatNotifier_settings.chatFrame); - return; end end end