Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to blacklist msg from the searched msg #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down