Erik L. Vonderscheer [07-14-09 - 05:21]
diff --git a/TradeFilter3.lua b/TradeFilter3.lua
index d445db3..76f3c91 100644
--- a/TradeFilter3.lua
+++ b/TradeFilter3.lua
@@ -57,7 +57,6 @@ local debugFrame = L["debugFrame"]
local repeatFrame = L["repeatFrame"]
local lastmsg
local lastuserID
-local last_msg = ""
--[[ Database Defaults ]]--
defaults = {
@@ -203,11 +202,13 @@ function TF3:BlackList(userID, msg)
local msg = lower(msg)
local msg = sub(msg, " ", "")
for _,word in pairs(blword) do
- if find(msg,word) then
+ if (find(msg,word)) then
--@alpha@
- if (TF3.db.profile.debug and msg ~= last_msg) then
- TF3:FindFrame(debugFrame, "|cFFFF0000[" .. L["bLists"] .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
- last_msg = msg
+ if (lastmsg ~= msg) then
+ if (TF3.db.profile.debug) then
+ TF3:FindFrame(debugFrame, "|cFFFF0000[" .. L["bLists"] .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
+ lastmsg = msg
+ end
end
--@end-alpha@
return true
@@ -222,11 +223,13 @@ function TF3:WhiteList(userID, msg)
local msg = lower(msg)
local msg = sub(msg, " ", "")
for _,word in pairs(wlword) do
- if find(msg,word) then
+ if (find(msg,word) and TF3:FindRepeat(userID, msg) == false) then
--@alpha@
- if (TF3.db.profile.debug and msg ~= last_msg) then
- TF3:FindFrame(debugFrame, "|cFFFFFF80[" .. L["wLists"] .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
- last_msg = msg
+ if (lastmsg ~= msg) then
+ if (TF3.db.profile.debug) then
+ TF3:FindFrame(debugFrame, "|cFFFFFF80[" .. L["wLists"] .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
+ lastmsg = msg
+ end
end
--@end-alpha@
return true
@@ -247,15 +250,12 @@ function TF3:FindRepeat(userID, msg)
if (msg == repeatdata[userID].lastmsg and gtime - repeatdata[userID].lastIndex < tonumber(TF3.db.profile.time_repeats)) then
repeatdata[userID].repeats = repeatdata[userID].repeats + 1
if (repeatdata[userID].repeats >= tonumber(TF3.db.profile.num_repeats)) then
- if (msg ~= last_msg) then
- --@alpha@
- if (TF3.db.profile.debug) then
- TF3:FindFrame(repeatFrame, "|cFFFF8C00[" .. L["#RPT"] .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
- end
- --@end-alpha@
- TF3.db.profile.repeats_blocked = TF3.db.profile.repeats_blocked + 1
- last_msg = msg
- end
+ --@alpha@
+--~ if (TF3.db.profile.debug) then
+--~ TF3:FindFrame(repeatFrame, "|cFFFF8C00[" .. L["#RPT"] .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
+--~ end
+ --@end-alpha@
+--~ TF3.db.profile.repeats_blocked = TF3.db.profile.repeats_blocked + 1
return true
end
elseif (msg ~= repeatdata[userID].lastmsg) then
@@ -304,48 +304,49 @@ local function PreFilterFunc_Say(self, event, ...)
local filtered = false
local msg = arg1 or select(1, ...)
local userID = arg2 or select(2, ...)
- if (event == "CHAT_MSG_SAY" and TF3.db.profile.filterSAY and TF3:IsFriend(userID) == false) then
- if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(userID, msg) == true) then
- filtered = false
- elseif (TF3:BlackList(userID, msg) == true) then
- filtered = true
- elseif (TF3.db.profile.repeat_enable) then
- if (TF3:FindRepeat(userID, msg) == true) then
+ if (lastmsg ~= msg) then
+ if (event == "CHAT_MSG_SAY" and TF3.db.profile.filterSAY and TF3:IsFriend(userID) == false) then
+ if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(userID, msg) == true) then
+ filtered = false
+ elseif (TF3:BlackList(userID, msg) == true) then
filtered = true
else
filtered = TF3:FilterFunc(...)
end
else
- filtered = TF3:FilterFunc(...)
+ filtered = false
end
+ lastmsg = msg
else
- filtered = false
+ if (TF3.db.profile.repeat_enable) then
+ filtered = TF3:FindRepeat(userID, msg)
+ end
end
return filtered
end
-
--[[ Check for YELL Channel and User setting ]]--
local function PreFilterFunc_Yell(self, event, ...)
local filtered = false
local msg = arg1 or select(1, ...)
local userID = arg2 or select(2, ...)
- if (event == "CHAT_MSG_YELL" and TF3.db.profile.filterYELL and TF3:IsFriend(userID) == false) then
- if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(userID, msg) == true) then
- filtered = false
- elseif (TF3:BlackList(userID, msg) == true) then
- filtered = true
- elseif (TF3.db.profile.repeat_enable) then
- if (TF3:FindRepeat(userID, msg) == true) then
+ if (lastmsg ~= msg) then
+ if (event == "CHAT_MSG_YELL" and TF3.db.profile.filterYELL and TF3:IsFriend(userID) == false) then
+ if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(userID, msg) == true) then
+ filtered = false
+ elseif (TF3:BlackList(userID, msg) == true) then
filtered = true
else
filtered = TF3:FilterFunc(...)
end
else
- filtered = TF3:FilterFunc(...)
+ filtered = false
end
+ lastmsg = msg
else
- filtered = false
+ if (TF3.db.profile.repeat_enable) then
+ filtered = TF3:FindRepeat(userID, msg)
+ end
end
return filtered
end
@@ -358,58 +359,47 @@ local function PreFilterFunc(self, event, ...)
local zoneID = arg7 or select(7, ...)
local chanID = arg8 or select(8, ...)
--[[ Check for Trade Channel and User setting ]]--
- if (zoneID == 2 and TF3.db.profile.filtertrade and TF3:IsFriend(userID) == false) then
- if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(userID, msg) == true) then
- filtered = false
- elseif (TF3:BlackList(userID, msg) == true) then
- filtered = true
- elseif (TF3.db.profile.repeat_enable) then
- if (TF3:FindRepeat(userID, msg) == true) then
+ if (lastmsg ~= msg) then
+ if (zoneID == 2 and TF3.db.profile.filtertrade and TF3:IsFriend(userID) == false) then
+ if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(userID, msg) == true) then
+ filtered = false
+ elseif (TF3:BlackList(userID, msg) == true) then
filtered = true
else
filtered = TF3:FilterFunc(...)
end
- else
- filtered = TF3:FilterFunc(...)
- end
- elseif (zoneID == 2 and not TF3.db.profile.filterTrade) then
- filtered = false
- end
- --[[ Check for General Channel and User setting ]]--
- if (chanID == 1 and TF3.db.profile.filtergeneral and TF3:IsFriend(userID) == false) then
- if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(userID, msg) == true) then
+ elseif (zoneID == 2 and not TF3.db.profile.filterTrade) then
filtered = false
- elseif (TF3:BlackList(userID, msg) == true) then
- filtered = true
- elseif (TF3.db.profile.repeat_enable) then
- if (TF3:FindRepeat(userID, msg) == true) then
+ end
+ --[[ Check for General Channel and User setting ]]--
+ if (chanID == 1 and TF3.db.profile.filtergeneral and TF3:IsFriend(userID) == false) then
+ if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(userID, msg) == true) then
+ filtered = false
+ elseif (TF3:BlackList(userID, msg) == true) then
filtered = true
else
filtered = TF3:FilterFunc(...)
end
- else
- filtered = TF3:FilterFunc(...)
- end
- elseif (chanID == 1 and not TF3.db.profile.filterGeneral) then
- filtered = false
- end
- --[[ Check for LFG Channel and User setting ]]--
- if (zoneID == 26 and TF3.db.profile.filterLFG and TF3:IsFriend(userID) == false) then
- if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(userID, msg) == true) then
+ elseif (chanID == 1 and not TF3.db.profile.filterGeneral) then
filtered = false
- elseif (TF3:BlackList(userID, msg) == true) then
- filtered = true
- elseif (TF3.db.profile.repeat_enable) then
- if (TF3:FindRepeat(userID, msg) == true) then
+ end
+ --[[ Check for LFG Channel and User setting ]]--
+ if (zoneID == 26 and TF3.db.profile.filterLFG and TF3:IsFriend(userID) == false) then
+ if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(userID, msg) == true) then
+ filtered = false
+ elseif (TF3:BlackList(userID, msg) == true) then
filtered = true
else
filtered = TF3:FilterFunc(...)
end
- else
- filtered = TF3:FilterFunc(...)
+ elseif (chanID == 26 and not TF3.db.profile.filterLFG) then
+ filtered = false
+ end
+ lastmsg = msg
+ else
+ if (TF3.db.profile.repeat_enable) then
+ filtered = TF3:FindRepeat(userID, msg)
end
- elseif (chanID == 26 and not TF3.db.profile.filterLFG) then
- filtered = false
end
return filtered
end
@@ -435,49 +425,45 @@ function TF3:FilterFunc(...)
filtered = true
--@alpha@
if (TF3.db.profile.debug) then
- if (msg ~= last_msg) then
- TF3:FindFrame(debugFrame, "|cFFC08080[" .. chan .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
- end
+ TF3:FindFrame(debugFrame, "|cFFC08080[" .. chan .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
end
--@end-alpha@
if (zoneID == 2) then
for i,v in pairs(TF3.db.profile.filters.TRADE) do
--@alpha@
- if (TF3.db.profile.debug) then
- if (msg ~= last_msg) then
+ if (lastmsg ~= msg or lastuserID ~= userID) then
+ if (TF3.db.profile.debug) then
TF3:FindFrame(debugFrame, L["CFM"] .. " " .. v)
end
- end
- --@end-alpha@
- if (find(msg,v)) then
- --@alpha@
- if (TF3.db.profile.debug) then
- if (msg ~= last_msg) then
+ --@end-alpha@
+ if (find(msg,v)) then
+ --@alpha@
+ if (TF3.db.profile.debug) then
TF3:FindFrame(debugFrame, L["MATCHED"] .. " |cffff8080" .. v .. "|r")
- last_msg = msg
+ lastmsg, lastuserID = msg, userID
end
+ --@end-alpha@
+ filtered = false
end
- --@end-alpha@
- filtered = false
end
end
else
for i,v in pairs(TF3.db.profile.filters.BASE) do
--@alpha@
- if (msg ~= last_msg) then
+ if (lastmsg ~= msg or lastuserID ~= userID) then
+ if (TF3.db.profile.debug) then
TF3:FindFrame(debugFrame, L["CFM"] .. " " .. v)
end
- --@end-alpha@
- if (find(msg,v)) then
- --@alpha@
- if (TF3.db.profile.debug) then
- if (msg ~= last_msg) then
+ --@end-alpha@
+ if (find(msg,v)) then
+ --@alpha@
+ if (TF3.db.profile.debug) then
TF3:FindFrame(debugFrame, L["MATCHED"] .. " |cffff8080" .. v .. "|r")
- last_msg = msg
+ lastmsg, lastuserID = msg, userID
end
+ --@end-alpha@
+ filtered = false
end
- --@end-alpha@
- filtered = false
end
end
end
@@ -492,7 +478,6 @@ function TF3:FilterFunc(...)
TF3:FindFrame(redirectFrame, "|cFFC08080[" .. chan .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
end
lastmsg, lastuserID = msg, userID
- last_msg = msg
end
end
end
diff --git a/TradeFilter3Locale.lua b/TradeFilter3Locale.lua
index fe5210f..547919c 100644
--- a/TradeFilter3Locale.lua
+++ b/TradeFilter3Locale.lua
@@ -32,6 +32,12 @@ if L then
if GetLocale() == "zhTW" then return end
end
+local L = LibStub("AceLocale-3.0"):NewLocale("TradeFilter3", "koKR")
+if L then
+--@localization(locale="koKR", format="lua_additive_table", same-key-is-true=true, handle-subnamespaces="subtable")@
+if GetLocale() == "koKR" then return end
+end
+
local L = LibStub("AceLocale-3.0"):NewLocale("TradeFilter3", "frFR")
if L then
--@localization(locale="frFR", format="lua_additive_table", same-key-is-true=true, handle-subnamespaces="subtable")@