SendAddonMessage("STS_?Version",GetAddOnMetadata("StopTradeSpam","Version"),"WHISPER",STScommand[2]) |
end |
dcfa(GetAddOnMetadata("StopTradeSpam","Version")) |
elseif STScommand[1] == "options" then |
elseif STScommand[1] == "options" or STScommand[1] == "o" then |
if IsAddOnLoaded("StopTradeSpam_Options") then |
InterfaceOptionsFrame_OpenToCategory("StopTradeSpam"); |
else |
LoadAddOn("StopTradeSpam_Options") |
InterfaceOptionsFrame_OpenToCategory("StopTradeSpam"); |
end |
elseif STScommand[1] == "debug" then |
if STScommand[2] then |
STS_SV["debug"] = true |
dcfa("debug flag set") |
else |
STS_SV["debug"] = nil |
dcfa("debug flag unset") |
end |
else |
dcfa("Wrong parameters.") |
end |
|
end |
local function STS_ChatFilter(self, event, ...) |
if (select(2,...) == UnitName("player")) or (select(6,...) == "GM") then |
if (select(2,...) == UnitName("player")) or (select(2,...) == "") or (select(6,...) == "GM") then |
return false,... |
elseif event == "CHAT_MSG_CHANNEL" then |
if sts_last_msg == select(11,...) then |
if sts_last_action == 1 then -- filtered based on last scan of same message |
if sts_last_action >= 1 then -- filtered based on last scan of same message |
return true |
elseif sts_last_action == 0 then |
return false,... |
elseif sts_last_action == -1 then |
return false,sts_notify..STS_SV["settings"]["notify_new"].." \124r"..select(1,...),select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...) |
elseif sts_last_action <= -1 then |
return false,sts_last_msgtext,select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...) |
end |
else |
sts_last_msg = select(11,...) |
end |
if select(7,...) == 2 then sts_session_all = sts_session_all + 1 end |
--debug: not STS_SV["debug"] and |
if STS_SV["ignore"][tignlist][select(2,...)] then |
if select(7,...) == 2 then sts_session_filtered = sts_session_filtered + 1 end |
sts_last_action = 1 |
return true |
-- debug: return all: return false,select(1,...),select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...) |
if STS_SV["settings"][event][select(8,...)] then -- if channel is activated for ignorelist in settings (default) |
if select(7,...) == 2 then sts_session_filtered = sts_session_filtered + 1 end |
sts_last_action = 1 |
return true |
else --just notify |
sts_last_msgtext = sts_notify..STS_SV["settings"]["notify_tign"].."\124r "..select(1,...) |
sts_last_action = -1 |
return false,sts_last_msgtext,select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...) |
end |
end |
if select(7,...) == 2 then -- Trade Channel: Filter this! |
-- local sp = " # " --debug |
local msg = select(1,...) |
local spamfound = 0 |
for _,wle in pairs(STS_SV[sts_lang]["whitelist"]) do |
if strfind(msg, wle) then |
spamfound = spamfound - 1 |
break -- TODO: point system? don't break in that case |
spamfound = spamfound - 2 --TODO: evaluate numbers |
-- sp = sp..wle.." # " --debug |
--debug/deprecated break -- TODO: point system? don't break in that case |
end |
end |
if spamfound == 0 then |
for _,ble in pairs(STS_SV[sts_lang]["blacklist"]) do |
if strfind(msg, ble) then |
spamfound = spamfound + 1 |
break -- TODO: point system? don't break in that case |
end |
--debug/deprecated if spamfound == 0 then |
for _,ble in pairs(STS_SV[sts_lang]["blacklist"]) do |
if strfind(msg, ble) then |
spamfound = spamfound + 1 |
-- sp = sp..ble.." # " --debug |
--debug/deprecated break -- TODO: point system? don't break in that case |
end |
end |
--debug/deprecated end |
-- sp = sp.."# #" --debug |
if spamfound > 0 then |
-- Ignore author of spam message here |
-- if iw_ComplainChat and false then --debug and should be removed |
-- ComplainChat(select(11,...)) |
-- dcfa(select(2,...).." reported") |
-- end |
sts_quiet = 1 |
STS_AddIgnore(select(2,...), "STS: ["..select(4,...).."] "..STS_ColoredNameLink(...)..": "..msg) |
sts_session_filtered = sts_session_filtered + 1 |
if spamfound > 2 then |
ComplainChat(select(11,...)) |
-- dcfa(select(2,...).." reported") |
end |
if STS_SV["settings"]["showblack"] then |
sts_last_action = -1 |
return false,sts_notify..STS_SV["settings"]["notify_new"].." \124r"..select(1,...),select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...) |
-- dcfa("Spam gefunden: ["..select(4,...).."] "..STS_ColoredNameLink(...)..": "..msg) -- Chatline is not needed: select(11,...); except for reporting spam |
--debug w/: sts_last_msgtext = strsub("<"..spamfound.."> "..sp.." "..sts_notify..STS_SV["settings"]["notify_new"].." \124r"..select(1,...),1,255) |
sts_last_msgtext = strsub(sts_notify..STS_SV["settings"]["notify_new"].." \124r"..select(1,...),1,255) |
return false,sts_last_msgtext,select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...) |
else |
sts_last_action = 1 |
return true |
end |
else |
--debug w/: sts_last_msgtext = strsub("<"..spamfound.."> "..sp.." "..select(1,...),1,255) |
sts_last_action = 0 |
return false,... |
--debug w/: return false,sts_last_msgtext,select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...) |
end |
end |
sts_last_action = 0 |
return false,... |
elseif tign_notify[event] and STS_SV["ignore"][tignlist][select(2,...)] then |
return false, sts_notify..STS_SV["settings"]["notify_tign"].."\124r "..select(1,...),select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...) |
elseif tign_filterthis[event] and STS_SV["ignore"][tignlist][select(2,...)] then |