Quantcast

Changed the way TradeFilter checks for party/raid members say/yell filtration.

Erik L. Vonderscheer [02-18-11 - 06:24]
Changed the way TradeFilter checks for party/raid members say/yell filtration.
Filename
.pkgmeta
TradeFilter3.lua
TradeFilter3.toc
TradeFilter3Options.lua
diff --git a/.pkgmeta b/.pkgmeta
index 510d3c8..9815f21 100644
--- a/.pkgmeta
+++ b/.pkgmeta
@@ -40,9 +40,6 @@ externals:
  libs/AceGUI-3.0:
   url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceGUI-3.0
   tag: latest
- libs/AceTimer-3.0:
-  url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceTimer-3.0
-  tag: latest
  libs/AceAddon-3.0:
   url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceAddon-3.0
   tag: latest
diff --git a/TradeFilter3.lua b/TradeFilter3.lua
index f8e66e2..5d9afe9 100644
--- a/TradeFilter3.lua
+++ b/TradeFilter3.lua
@@ -32,7 +32,7 @@ File Date: @file-date-iso@
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 --]]

-TradeFilter3 = LibStub("AceAddon-3.0"):NewAddon("TradeFilter3", "AceEvent-3.0", "AceTimer-3.0")
+TradeFilter3 = LibStub("AceAddon-3.0"):NewAddon("TradeFilter3", "AceEvent-3.0")
 local L =  LibStub("AceLocale-3.0"):GetLocale("TradeFilter3", true)
 local libfriends = LibStub("LibFriends-1.0")
 local LDB = LibStub("LibDataBroker-1.1", true)
@@ -62,10 +62,6 @@ local lastuserID
 local msgsFiltered = 0
 local msgsBlackFiltered = 0

-TF3.raidTimer = nil
-TF3.partyTimer = nil
-TF3.currentPartyMembers = {}
-
 local MAJOR_VERSION = GetAddOnMetadata("TradeFilter3", "Version")
 if (len(MAJOR_VERSION)<=6) then
 	TF3.version = sub(MAJOR_VERSION, 0, 6)
@@ -153,8 +149,6 @@ end

 function TF3:IsLoggedIn()
 	self:RegisterEvent("FRIENDLIST_UPDATE", "GetFriends")
-	self:RegisterEvent("PARTY_MEMBERS_CHANGED", "GetParty", "party")
-	self:RegisterEvent("RAID_ROSTER_UPDATE", "GetParty", "raid")
 	libfriends.RegisterCallback(self, "Added")
 	libfriends.RegisterCallback(self, "Removed")
 	self:UnregisterEvent("PLAYER_LOGIN")
@@ -259,77 +253,25 @@ function TF3:GetColoredName(userID, cName)
 end

 --[[ Party Functions ]]--
-function TF3:GetParty(arg)
-	if not (TF3.db.profile.exmptparty) then return end
-	local currentParty = TF3.currentPartyMembers
-	local numPartyMembers = GetNumPartyMembers()
-	local numRaidMembers = GetNumRaidMembers()
-	if (arg == "raid") then
-		if (numRaidMembers > 0 and #currentParty ~= numRaidMembers) then
-			TF3:WipeTable(TF3.currentPartyMembers)
-			for i=1, numRaidMembers, 1 do
-				local partymember = UnitName("raid"..i)
-				if (partymember and partymember ~= UNKNOWNOBJECT and partymember ~= UKNOWNBEING) then
-					currentParty[i] = partymember
-					if (TF3.db.profile.debug) then
-						TF3:FindFrame(debugFrame, "|cFFFFFF80" .. partymember .. " " .. L["PADD"] .. "|r\n")
-					end
-				elseif (partymember == UNKNOWNOBJECT or partymember == UKNOWNBEING) then
-					if (TF3.db.profile.debug) then
-						TF3:FindFrame(debugFrame, "|cFFFFFF80" .. L["MIPM"] .. "|r")
-					end
-					if not (TF3:TimeLeft(TF3.raidTimer)) then
-						TF3.raidTimer = TF3:ScheduleTimer("GetParty", 15, "raid")
-					end
-					break
-				end
-			end
-		elseif (numRaidMembers == 0) then
-			if (TF3.db.profile.debug) then
-				TF3:FindFrame(debugFrame, "|cFFFFFF80" .. L["Wiping party exempt list"] .. "|r")
-			end
-			self:CancelAllTimers()
-			TF3:WipeTable(currentParty)
-		end
-	end
-	if (arg == "party") then
-		if (numPartyMembers > 0 and #currentParty ~= numPartyMembers and numRaidMembers == 0) then
-			TF3:WipeTable(currentParty)
-			for i=1, numPartyMembers, 1 do
-				local partymember = UnitName("party"..i)
-				if (partymember and partymember ~= UNKNOWNOBJECT and partymember ~= UKNOWNBEING) then
-					currentParty[i] = partymember
-					if (TF3.db.profile.debug) then
-						TF3:FindFrame(debugFrame, "|cFFFFFF80" .. partymember .. " " .. L["PADD"] .. "|r\n")
-					end
-				elseif (partymember == UNKNOWNOBJECT or partymember == UKNOWNBEING) then
-					if (TF3.db.profile.debug) then
-						TF3:FindFrame(debugFrame, "|cFFFFFF80" .. L["MIPM"] .. "|r")
-					end
-					if not (TF3:TimeLeft(TF3.partyTimer)) then
-						TF3.partyTimer = TF3:ScheduleTimer("GetParty", 10, "party")
-					end
-					break
-				end
-			end
-		elseif (numPartyMembers == 0) then
-			if (TF3.db.profile.debug) then
-				TF3:FindFrame(debugFrame, "|cFFFFFF80" .. L["Wiping party exempt list"] .. "|r")
-			end
-			self:CancelAllTimers()
-			TF3:WipeTable(currentParty)
-		end
-	end
-end
-
 function TF3:IsParty(userID)
 	if not (TF3.db.profile.exmptparty) then return false end
-	local currentParty = TF3.currentPartyMembers
-	for _,partymember in pairs(currentParty) do
-		if find(userID,partymember) then
-			return true
-		end
-	end
+	local numPartyMembers = GetNumPartyMembers()
+	local numRaidMembers = GetNumRaidMembers()
+  if (numRaidMembers > 0) then
+    for i=1, numRaidMembers, 1 do
+      local partymember = UnitName("raid"..i)
+      if find(userID,partymember) then
+        return true
+      end
+    end
+  elseif (numPartyMembers > 0 and numRaidMembers == 0) then
+    for i=1, numPartyMembers, 1 do
+      local partymember = UnitName("party"..i)
+      if find(userID,partymember) then
+        return true
+      end
+    end
+  end
 	return false
 end

diff --git a/TradeFilter3.toc b/TradeFilter3.toc
index fef7521..86ee061 100644
--- a/TradeFilter3.toc
+++ b/TradeFilter3.toc
@@ -37,7 +37,6 @@ libs\AceConsole-3.0\AceConsole-3.0.xml
 libs\AceDB-3.0\AceDB-3.0.xml
 libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
 libs\AceEvent-3.0\AceEvent-3.0.xml
-libs\AceTimer-3.0\AceTimer-3.0.xml
 libs\AceGUI-3.0\AceGUI-3.0.xml
 libs\AceLocale-3.0\AceLocale-3.0.xml
 libs\AceConfig-3.0\AceConfig-3.0.xml
diff --git a/TradeFilter3Options.lua b/TradeFilter3Options.lua
index 044e437..6685be2 100644
--- a/TradeFilter3Options.lua
+++ b/TradeFilter3Options.lua
@@ -685,13 +685,72 @@ function TF3:getOptions()
 								},
 							},
 						},
-						outputGroup = {
+						exemptGroupMain = {
 							type = "group",
 							handler = TF3,
+							childGroups = "tab",
 							order = 5,
 							disabled = function()
 								return not TF3.db.profile.turnOn
 							end,
+							name = L["Exempt List"],
+							desc = L["Current Exempt List"],
+							args = {
+								enable_exempt_party = {
+									type = 'toggle',
+									order = 1,
+									disabled = false,
+									name = L["Party Members"],
+									desc = L["If enabled party members will be exempt from filtration."],
+									get = function() return TF3.db.profile.exmptparty end,
+									set = function() TF3.db.profile.exmptparty = not TF3.db.profile.exmptparty end,
+								},
+								enable_exempt_friends = {
+									type = 'toggle',
+									order = 2,
+									disabled = false,
+									name = L["Friends"],
+									desc = L["If enabled your friends list will be exempt from filtration."],
+									get = function() return TF3.db.profile.exmptfriendslist end,
+									set = function() TF3.db.profile.exmptfriendslist = not TF3.db.profile.exmptfriendslist end,
+								},
+								exemptGroupFriends = {
+									type = "group",
+									handler = TF3,
+									order = 3,
+									disabled = function()
+										return not TF3.db.profile.turnOn
+									end,
+									name = L["Exempt Friend List"],
+									args = {
+										currentFriends_table_content = {
+											type = 'description',
+											fontSize = "medium",
+											disabled = true,
+											order = 1,
+											name = function()
+												local ret = ""
+												for k,v in pairs(TF3.db.profile.friendslist) do
+													if ret == "" then
+														ret = v
+													else
+														ret = ret .. "\n" .. v
+													end
+												end
+												return ret
+											end,
+										},
+									},
+								},
+							},
+						},
+						outputGroup = {
+							type = "group",
+							handler = TF3,
+							order = 6,
+							disabled = function()
+								return not TF3.db.profile.turnOn
+							end,
 							name = L["OUTPUT"],
 							desc = L["OUTPUT"],
 							args = {
@@ -763,111 +822,6 @@ function TF3:getOptions()
 								},
 							},
 						},
-						exemptGroupMain = {
-							type = "group",
-							handler = TF3,
-							childGroups = "tab",
-							order = 6,
-							disabled = function()
-								return not TF3.db.profile.turnOn
-							end,
-							name = L["Exempt List"],
-							desc = L["Current Exempt List"],
-							args = {
-								enable_exempt_party = {
-									type = 'toggle',
-									order = 1,
-									disabled = false,
-									name = L["Party Members"],
-									desc = L["If enabled party members will be exempt from filtration."],
-									get = function() return TF3.db.profile.exmptparty end,
-									set = function() TF3.db.profile.exmptparty = not TF3.db.profile.exmptparty end,
-								},
-								enable_exempt_friends = {
-									type = 'toggle',
-									order = 2,
-									disabled = false,
-									name = L["Friends"],
-									desc = L["If enabled your friends list will be exempt from filtration."],
-									get = function() return TF3.db.profile.exmptfriendslist end,
-									set = function() TF3.db.profile.exmptfriendslist = not TF3.db.profile.exmptfriendslist end,
-								},
-								exemptGroupParty = {
-									type = "group",
-									handler = TF3,
-									order = 3,
-									disabled = function()
-										return not TF3.db.profile.turnOn
-									end,
-									name = L["Exempt Party Members"],
-									args = {
- 		 								rescan_party = {
- 		 									type = 'execute',
- 		 									order = 1,
- 		 									name = "GetParty(\"pary\")",
-											hidden = function()
-												return not TF3.db.profile.debug
-											end,
- 		 									func = function() TF3:GetParty("party") end,
- 		 								},
- 		 								rescan_raid = {
- 		 									type = 'execute',
- 		 									order = 2,
- 		 									name = "GetParty(\"raid\")",
-											hidden = function()
-												return not TF3.db.profile.debug
-											end,
- 		 									func = function() TF3:GetParty("raid") end,
- 		 								},
-										currentPartyMembers_table_content = {
-											type = 'description',
-											fontSize = "medium",
-											disabled = true,
-											order = 3,
-											name = function()
-												local ret = ""
-												for k,v in pairs(TF3.currentPartyMembers) do
-													if ret == "" then
-														ret = v
-													else
-														ret = ret .. "\n" .. v
-													end
-												end
-												return ret
-											end,
-										},
-									},
-								},
-								exemptGroupFriends = {
-									type = "group",
-									handler = TF3,
-									order = 4,
-									disabled = function()
-										return not TF3.db.profile.turnOn
-									end,
-									name = L["Exempt Friend List"],
-									args = {
-										currentFriends_table_content = {
-											type = 'description',
-											fontSize = "medium",
-											disabled = true,
-											order = 1,
-											name = function()
-												local ret = ""
-												for k,v in pairs(TF3.db.profile.friendslist) do
-													if ret == "" then
-														ret = v
-													else
-														ret = ret .. "\n" .. v
-													end
-												end
-												return ret
-											end,
-										},
-									},
-								},
-							},
-						},
 						Profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(TF3.db),
 					},
 				},