/trunk/StopTradeSpam
libs\CallbackHandler-1.0\CallbackHandler-1.0.lua |
libs\LibDataBroker-1.1\LibDataBroker-1.1.lua |
init.lua |
StopTradeSpam_Options.xml |
StopTradeSpam_Options.lua |
StopTradeSpam.lua |
StopTradeSpam_Options.lua |
StopTradeSpam_Options.xml |
</Anchor> |
</Anchors> |
</FontString> |
<Frame name="STSOPanel"> |
<Scripts> |
<!-- <OnLoad> |
STSO_Load(self) |
</OnLoad> |
<OnShow> |
STSO_Show(self) |
</OnShow>--> |
</Scripts> |
<Layers> |
<!-- <Layer level="ARTWORK"> |
</Layer>--> |
<Layer level="OVERLAY"> |
<FontString inherits="GameFontNormal" text="StopTradeSpam Config"> |
<Anchors> |
<Anchor point="TOP" relativeTo="$parent"> |
<Offset><AbsDimension x="0" y="-20"/></Offset> |
</Anchor> |
</Anchors> |
</FontString> |
<!-- <FontString inherits="GameFontNormal" text="Enable ignoring players in Channel '1'"> |
<Color r="1" g="1" b="1" a="1"/> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parent"> |
<Offset><AbsDimension x="45" y="-55"/></Offset> |
</Anchor> |
</Anchors> |
</FontString>--> |
</Layer> |
</Layers> |
<Frames> |
<!-- <CheckButton name="$parent_CHAT_MSG_CHANNEL_1" inherits="OptionsCheckButtonTemplate"> |
<Anchors> |
<Anchor point="TOPLEFT" relativeTo="$parent"> |
<Offset><AbsDimension x="20" y="-50"/></Offset> |
</Anchor> |
</Anchors> |
<Scripts><OnLoad>STSO_Load(self);</OnLoad></Scripts> |
</CheckButton>--> |
</Frames> |
</Frame> |
<!-- <Frame name="$parent_white" parent="STSO_Panel"> |
<Scripts> |
<OnLoad> |
STSO_Load(self) |
</OnLoad> |
<OnShow> |
STSO_Show(self) |
</OnShow> |
</Scripts> |
</Frame> |
<Frame name="$parent_black" parent="STSO_Panel"> |
<Scripts> |
<OnLoad> |
STSO_Load(self) |
</OnLoad> |
<OnShow> |
STSO_Show(self) |
</OnShow> |
</Scripts> |
</Frame> |
<Frame name="$parent_ignore" parent="STSO_Panel"> |
<Scripts> |
<OnLoad> |
STSO_Load(self) |
</OnLoad> |
<OnShow> |
STSO_Show(self) |
</OnShow> |
</Scripts> |
</Frame>--> |
</Ui> |
return true |
end |
local function STS_GetLanguage(...) |
local getlang = STS_SV["language"][tignlist] |
if select(1,...) == "print" then |
dcfa(getlang) |
end |
return getlang |
end |
function STS_SetLanguage(setlang) |
if not STS_SV[setlang] then |
STS_SV[setlang] = { |
end |
end |
function STS_List(...) |
local function STS_List(...) |
local list = "list" |
if select(1,...) then list = select(1,...) end |
if list == "white" or list == "black" or list == "list" then |
return false |
end |
function STS_PostReason(ign_name) |
local function STS_PostReason(ign_name) |
if not STS_SV["ignore"][tignlist][ign_name] then |
dcfa("\""..ign_name.."\" not found on T-ignorelist.") |
else |
local key = select(1,...) |
local list = select(2,...) |
local val = 0 |
if select(3,...) then |
val = select(3,...) |
elseif type(select(2,...)) == "number" then |
if tonumber(select(2,...)) then |
val = select(2,...) |
list = "list" |
else |
end |
end |
if not key then |
dcfa("Wrong parameters. Use /sts add white [entry] or /sts add black [entry].") |
dcfa("Wrong parameters. Use /sts add <valueOrList> <entry> .") |
elseif list == "white" or list == "black" or list == "list" then |
STS_SV[sts_lang]["list"][key] = val |
dcfa("Filter added: \""..key.."\" with value "..val) --TODO: locale |
return false,1 |
end |
function STS_Slash(argument) |
local function STS_Slash(argument) |
local STScommand = { strsplit(" ", argument) } |
if STScommand[1] == "help" or argument == "" then |
dcfa("\124cffff0000S\124cff00ff00top \124cffff0000T\124cff00ff00rade \124cffff0000S\124cff00ff00pam") |
end |
elseif STScommand[1] == "unignore" or STScommand[1] == "delignore" then |
STS_DelIgnore(STScommand[2]) |
elseif (STScommand[1] == "lang" or STScommand[1] == "language") and STScommand[2] == "set" then |
STS_SetLanguage(STScommand[3]) |
elseif (STScommand[1] == "lang" or STScommand[1] == "language") and (STScommand[2] == "del" or STScommand[2] == "remove") then |
STS_DelLanguage(STScommand[3]) |
elseif (STScommand[1] == "lang" or STScommand[1] == "language") then |
if STScommand[2] == "set" then |
STS_SetLanguage(STScommand[3]) |
elseif STScommand[2] == "del" or STScommand[2] == "remove" then |
STS_DelLanguage(STScommand[3]) |
else |
STS_GetLanguage("print") |
end |
elseif STScommand[1] == "stat" or STScommand[1] == "statistic" then |
STS_Statistic(true) |
elseif STScommand[1] == "post" then |
end |
else |
sts_last_msg = select(11,...) |
sts_last_msgtext = select(1,...) |
end |
if (select(2,...) == UnitName("player")) or (select(2,...) == "") or (select(6,...) == "GM") then |
sts_last_action = 0 |
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,...) |
-- 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! |
if spamfound > 0 then |
-- Ignore author of spam message here |
sts_quiet = 1 |
STS_AddIgnore(select(2,...), "STS: ["..select(4,...).."] "..STS_ColoredNameLink(...)..": "..msg) |
local new_ign = STS_AddIgnore(select(2,...), "STS: ["..select(4,...).."] "..STS_ColoredNameLink(...)..": "..msg) |
sts_session_filtered = sts_session_filtered + 1 |
if STS_SV["settings"]["complainchat"] and spamfound > 2 then |
ComplainChat(select(11,...)) |
--dcfa(select(2,...).." reported") |
end |
if STS_SV["settings"]["showblack"] then |
if STS_SV["settings"]["showblack"] and new_ign then |
sts_last_action = -1 |
--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) |
end |
else |
--debug w/: sts_last_msgtext = strsub("<"..spamfound.."> "..sp.." "..select(1,...),1,255) |
sts_last_action = 0 |
return false,... |
if not strfind(sts_last_msgtext,"^"..sts_notify) then |
sts_last_action = 0 |
end |
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,...) |
--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 |
for event,_ in pairs(tign_filterthis) do |
ChatFrame_AddMessageEventFilter(event, STS_ChatFilter) |
end |
STSO_Load(STSOPanel) |
STSO_Build() |
elseif event == "CHAT_MSG_ADDON" and strsub(select(1,...),1,3) == "STS" then |
if strsub(select(1,...),4,12) == "_?Version" then |
SendAddonMessage("STS_!Version",GetAddOnMetadata("StopTradeSpam","Version"),"WHISPER",select(4,...)) |