Erik L. Vonderscheer [07-29-09 - 03:45]
diff --git a/.pkgmeta b/.pkgmeta
index e8370b4..3a9dc38 100644
--- a/.pkgmeta
+++ b/.pkgmeta
@@ -52,5 +52,9 @@ externals:
libs/LibAboutPanel:
url: git://git.curseforge.net/wow/libaboutpanel/mainline.git
tag: latest
-
-
+ libs/LibDataBroker-1.1:
+ url: git://git.wowace.com/wow/libdatabroker-1-1/mainline.git
+ tag: latest
+ libs/LibDBIcon-1.0:
+ url: svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk
+ tag: latest
diff --git a/Docs/changelog.txt b/Docs/changelog.txt
index 614dffe..90fe6d5 100644
--- a/Docs/changelog.txt
+++ b/Docs/changelog.txt
@@ -1,4 +1,8 @@
== ChangeLog
+*r155
+**++LDB support for Repeats Blocked++
+**++Ability for Whitelist to bypass repeat filter++
+**++GUI layout changed a little++
*r148
**++Minor code cleanup++\\
**++AceTimer lib added for repeat table recycling++\\
diff --git a/TradeFilter3.lua b/TradeFilter3.lua
index 4443e6d..f282d40 100644
--- a/TradeFilter3.lua
+++ b/TradeFilter3.lua
@@ -73,10 +73,12 @@ defaults = {
filterGeneral = false,
filterTrade = true,
editfilter_enable = false,
- editlists_enable = false,
+ ebl = false,
+ ewl = false,
blacklist_enable = true,
whitelist_enable = true,
redirect_blacklist = false,
+ wlbp = false,
repeat_enable = true,
special_enable = false,
num_repeats = "2",
@@ -139,12 +141,51 @@ function TF3:FirstLogin()
TF3.db.profile.filters = L.FILTERS
end
+local function OnTooltipShow(self)
+ self:AddLine("|cffeda55fRight Click|r to open config GUI")
+ self:AddLine("|cffeda55fLeft Click|r reset repeat count")
+end
+
+local function OnEnter(self)
+ GameTooltip:SetOwner(self, "ANCHOR_NONE")
+ GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT")
+ GameTooltip:ClearLines()
+ OnTooltipShow(GameTooltip)
+ GameTooltip:Show()
+end
+
+local function OnLeave(self)
+ GameTooltip:Hide()
+end
+
+local function OnClick(clickedframe, button)
+ if (button == "RightButton") then
+ TF3:OpenOptions()
+ else
+ TF3.db.profile.repeats_blocked = 0
+ end
+end
+
function TF3:IsLoggedIn()
self:RegisterEvent("FRIENDLIST_UPDATE", "GetFriends")
friends.RegisterCallback(self, "Added")
friends.RegisterCallback(self, "Removed")
self:ScheduleRepeatingTimer("RecycleTables", 1800, repeatdata)
self:UnregisterEvent("PLAYER_LOGIN")
+
+ if (LDB) then
+ TF3Frame = CreateFrame("Frame", "LDB_TradeFilter3")
+ TF3Frame.Blocked = LDB:NewDataObject(L["TFR"], {
+ type = "data source",
+ text = "0 Blocked Repeats",
+ value = TF3.db.profile.repeats_blocked,
+ suffix = "Repeats Blocked",
+ OnClick = OnClick,
+ OnEnter = OnEnter,
+ OnLeave = OnLeave,
+ OnTooltipShow = OnTooltipShow,
+ })
+ end
end
--[[ Helper Functions ]]--
@@ -291,7 +332,7 @@ function TF3:WhiteList(msg, userID, msgID)
local msg = lower(msg)
if (TF3.db.profile.whitelist_enable) then
for _,word in pairs(wlword) do
- if (find(msg,word) and TF3:FindRepeat(msg, userID, msgID) == false and TF3:BlackList(msg, userID, msgID) == false) then
+ if (find(msg,word) and TF3:FindRepeat(msg, userID, msgID, whitelist) == false and TF3:BlackList(msg, userID, msgID) == false) then
if (TF3.db.profile.debug) then
if (msgID ~= lastmsgID) then
TF3:FindFrame(debugFrame, "|cFFFFFF80[" .. L["wLists"] .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
@@ -322,27 +363,35 @@ function TF3:SpecialChans(chanName)
end
--[[ Repeat Func ]]--
-function TF3:FindRepeat(msg, userID, msgID)
- local gtime = math.floor(GetTime()*math.pow(10,0)+0.5) / math.pow(10,0)
- if (msgID ~= repeatdata[userID].lastmsgID and 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 (TF3.db.profile.debug) then
- if (msg ~= lastmsg) then
- TF3:FindFrame(repeatFrame, "|cFFFF8C00[" .. L["#RPT"] .. "]|r |cFFD9D9D9[" .. msgID .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
- TF3.db.profile.repeats_blocked = TF3.db.profile.repeats_blocked + 1
- lastmsg = msg
- end
- end
- return true
+function TF3:FindRepeat(msg, userID, msgID, arg)
+ if (arg == whitelist and not TF3.db.profile.wlbp) then
+ local gtime = math.floor(GetTime()*math.pow(10,0)+0.5) / math.pow(10,0)
+ if (msgID ~= repeatdata[userID].lastmsgID and 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 (TF3.db.profile.debug) then
+ if (msg ~= lastmsg) then
+ TF3:FindFrame(repeatFrame, "|cFFFF8C00[" .. L["#RPT"] .. "]|r |cFFD9D9D9[" .. msgID .. "]|r |cFFD9D9D9[" .. userID .. "]:|r |cFFC08080" .. msg .. "|r")
+ TF3.db.profile.repeats_blocked = TF3.db.profile.repeats_blocked + 1
+ if (LDB) then
+ TF3Frame.Blocked.text = TF3.db.profile.repeats_blocked .. "Repeats Blocked"
+ TF3Frame.Blocked.value = TF3.db.profile.repeats_blocked
+ end
+ lastmsg = msg
+ end
+ end
+ return true
+ end
+ elseif (msg ~= repeatdata[userID].lastmsg) then
+ repeatdata[userID].repeats = 1
end
- elseif (msg ~= repeatdata[userID].lastmsg) then
- repeatdata[userID].repeats = 1
+ repeatdata[userID].lastmsg = msg
+ repeatdata[userID].lastmsgID = msgID
+ repeatdata[userID].lastIndex = gtime
+ return false
+ else
+ return false
end
- repeatdata[userID].lastmsg = msg
- repeatdata[userID].lastmsgID = msgID
- repeatdata[userID].lastIndex = gtime
- return false
end
--[[ Window and Chat Functions ]]--
@@ -392,7 +441,7 @@ local function PreFilterFunc_Addon(self, event, ...)
repeatdata[userID].repeats = 1
end
if (distType == "GUILD" and find(prefix,"ET") and TF3.db.profile.filterGAC and TF3:IsFriend(userID) == false) then
- if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(msg, userID) == true) then
+ if (userID == UnitName("Player") and TF3.db.profile.filterSELF == false or TF3:WhiteList(msg, userID, msgID) == true) then
filtered = false
elseif (TF3:BlackList(msg, userID) == true) then
filtered = true
diff --git a/TradeFilter3.toc b/TradeFilter3.toc
index 39491fa..23d6d58 100644
--- a/TradeFilter3.toc
+++ b/TradeFilter3.toc
@@ -22,7 +22,10 @@
## X-Website: http://www.wowace.com/projects/trade-filter/
## X-Category: Chat & Communication
## X-Localizations: enUS, frFR, zhCN, zhTW, deDE, koKR
-## OptionalDeps: Ace3, LibAboutPanel
+## OptionalDeps: Ace3, LibAboutPanel, LibDataBroker-1.1, LibFriends-1.0
+#@no-lib-strip@
+## X-Embeds: Ace3, LibAboutPanel, LibDataBroker-1.1, LibFriends-1.0
+#@end-no-lib-strip@
## X-License: BSD
## Version: @project-version@
## Revision: @project-revision@
@@ -46,6 +49,7 @@ libs\AceConfig-3.0\AceConfig-3.0.xml
libs\LibFriends-1.0\lib.xml
libs\LibAboutPanel\LibAboutPanel.lua
#@end-no-lib-strip@
+libs\LibDataBroker-1.1\LibDataBroker-1.1.lua
## Locale ##
TradeFilter3Locale.lua
diff --git a/TradeFilter3Options.lua b/TradeFilter3Options.lua
index 56c1d16..e3899c2 100644
--- a/TradeFilter3Options.lua
+++ b/TradeFilter3Options.lua
@@ -197,24 +197,13 @@ options = {
order = 3,
name = L["BTF"],
},
- reset_tradefilters = {
- type = 'execute',
- disabled = function()
- return not TF3.db.profile.addfilter_enable
- end,
- order = 4,
- width = "double",
- name = L["RTF"],
- desc = L["RTF"],
- func = function() TF3.db.profile.filters.TRADE = TF3:CopyTable(L.FILTERS.TRADE) end,
- },
tradefilters = {
type = 'input',
disabled = function()
return not TF3.db.profile.addfilter_enable
end,
multiline = 8,
- order = 5,
+ order = 4,
width = "full",
name = L["BTF"],
desc = L["BTFD"],
@@ -242,30 +231,28 @@ options = {
end
end,
},
- optionsHeader2b = {
- type = "header",
- order = 6,
- name = L["BCF"],
- },
- reset_basefilters = {
+ reset_tradefilters = {
type = 'execute',
disabled = function()
return not TF3.db.profile.addfilter_enable
end,
- order = 7,
- width = "double",
- name = L["RBF"],
- desc = L["RBF"],
- func = function() TF3.db.profile.filters.BASE = TF3:CopyTable(L.FILTERS.BASE) end,
+ order = 5,
+ name = L["RTF"],
+ desc = L["RTF"],
+ func = function() TF3.db.profile.filters.TRADE = TF3:CopyTable(L.FILTERS.TRADE) end,
+ },
+ optionsHeader2b = {
+ type = "header",
+ order = 6,
+ name = L["BCF"],
},
-
basefilters = {
type = 'input',
disabled = function()
return not TF3.db.profile.addfilter_enable
end,
multiline = 8,
- order = 8,
+ order = 7,
width = "full",
name = L["BCF"],
desc = L["BCFD"],
@@ -293,6 +280,16 @@ options = {
end
end,
},
+ reset_basefilters = {
+ type = 'execute',
+ disabled = function()
+ return not TF3.db.profile.addfilter_enable
+ end,
+ order = 8,
+ name = L["RBF"],
+ desc = L["RBF"],
+ func = function() TF3.db.profile.filters.BASE = TF3:CopyTable(L.FILTERS.BASE) end,
+ },
},
},
listsGroup = {
@@ -305,61 +302,36 @@ options = {
name = L["listsGroup"],
desc = L["listsGD"],
args = {
- optionsHeader3 = {
+ optionsHeader3a = {
type = "header",
order = 1,
- name = L["bwLists"],
- },
- editlists_enable = {
- type = 'toggle',
- order = 2,
- width = "double",
- name = L["EditLists"],
- desc = L["EditLists"],
- get = function() return TF3.db.profile.editlists_enable end,
- set = function() TF3.db.profile.editlists_enable = not TF3.db.profile.editlists_enable end,
+ name = L["bLists"],
},
blacklist_enable = {
type = 'toggle',
- order = 3,
+ order = 2,
width = "double",
name = L["BLE"],
desc = L["BLE"],
get = function() return TF3.db.profile.blacklist_enable end,
set = function() TF3.db.profile.blacklist_enable = not TF3.db.profile.blacklist_enable end,
},
- whitelist_enable = {
+ editblacklist = {
type = 'toggle',
- order = 4,
- width = "double",
- name = L["WLE"],
- desc = L["WLE"],
- get = function() return TF3.db.profile.whitelist_enable end,
- set = function() TF3.db.profile.whitelist_enable = not TF3.db.profile.whitelist_enable end,
- },
- optionsHeader3a = {
- type = "header",
- order = 5,
- name = L["bLists"],
- },
- reset_blist = {
- type = 'execute',
- disabled = function()
- return not TF3.db.profile.editlists_enable
- end,
- order = 6,
+ order = 3,
width = "double",
- name = L["RBLS"],
- desc = L["RBLS"],
- func = function() TF3.db.profile.blacklist = TF3:CopyTable(L.BLACKLIST) end,
+ name = L["EBL"],
+ desc = L["EBL"],
+ get = function() return TF3.db.profile.ebl end,
+ set = function() TF3.db.profile.ebl = not TF3.db.profile.ebl end,
},
blist = {
type = 'input',
disabled = function()
- return not TF3.db.profile.editlists_enable
+ return not TF3.db.profile.ebl
end,
multiline = 8,
- order = 7,
+ order = 4,
width = "full",
name = L["bLists"],
usage = L["INPUSAGE"],
@@ -386,29 +358,55 @@ options = {
end
end,
},
+ reset_blist = {
+ type = 'execute',
+ disabled = function()
+ return not TF3.db.profile.ebl
+ end,
+ order = 5,
+ name = L["RBLS"],
+ desc = L["RBLS"],
+ func = function() TF3.db.profile.blacklist = TF3:CopyTable(L.BLACKLIST) end,
+ },
optionsHeader3b = {
type = "header",
- order = 8,
+ order = 6,
name = L["wLists"],
},
- reset_wlist = {
- type = 'execute',
- disabled = function()
- return not TF3.db.profile.editlists_enable
- end,
+ whitelist_enable = {
+ type = 'toggle',
+ order = 8,
+ width = "double",
+ name = L["WLE"],
+ desc = L["WLE"],
+ get = function() return TF3.db.profile.whitelist_enable end,
+ set = function() TF3.db.profile.whitelist_enable = not TF3.db.profile.whitelist_enable end,
+ },
+ editwhitelist = {
+ type = 'toggle',
order = 9,
width = "double",
- name = L["RWLS"],
- desc = L["RWLS"],
- func = function() TF3.db.profile.whitelist = TF3:CopyTable(L.WHITELIST) end,
+ name = L["EWL"],
+ desc = L["EWL"],
+ get = function() return TF3.db.profile.ewl end,
+ set = function() TF3.db.profile.ewl = not TF3.db.profile.ewl end,
+ },
+ whitelist_repeat_bypass = {
+ type = 'toggle',
+ order = 10,
+ width = "double",
+ name = L["RPTBYPASS"],
+ desc = L["RPTBYPASSD"],
+ get = function() return TF3.db.profile.wlbp end,
+ set = function() TF3.db.profile.wlbp = not TF3.db.profile.wlbp end,
},
wlist = {
type = 'input',
disabled = function()
- return not TF3.db.profile.editlists_enable
+ return not TF3.db.profile.ewl
end,
multiline = 8,
- order = 10,
+ order = 11,
width = "full",
name = L["wLists"],
usage = L["INPUSAGE"],
@@ -435,6 +433,16 @@ options = {
end
end,
},
+ reset_wlist = {
+ type = 'execute',
+ disabled = function()
+ return not TF3.db.profile.ewl
+ end,
+ order = 12,
+ name = L["RWLS"],
+ desc = L["RWLS"],
+ func = function() TF3.db.profile.whitelist = TF3:CopyTable(L.WHITELIST) end,
+ },
},
},
repeatGroup = {
@@ -502,7 +510,13 @@ options = {
width = "half",
name = L["RPTRESET"],
desc = L["RPTRESETD"],
- func = function() TF3.db.profile.repeats_blocked = 0 end,
+ func = function()
+ TF3.db.profile.repeats_blocked = 0
+ if (LDB) then
+ TF3Frame.Blocked.text = TF3.db.profile.repeats_blocked .. "Repeats Blocked"
+ TF3Frame.Blocked.value = TF3.db.profile.repeats_blocked
+ end
+ end,
},
},
},