diff Modules/OpenAll.lua @ 42:8168280420ae

Added a new option to both sound notifications to limit playing of the sound to once per mailbox visit, instead of once per mailbox refresh / bags update.
author Zerotorescue
date Sat, 11 Sep 2010 21:31:26 +0200
parents b79bb7b449c3
children 1805df31794d
line wrap: on
line diff
--- a/Modules/OpenAll.lua	Sat Sep 11 18:43:14 2010 +0200
+++ b/Modules/OpenAll.lua	Sat Sep 11 21:31:26 2010 +0200
@@ -9,7 +9,7 @@
 When shift clicking the Open All button it should override all filters.
 ]]
 
-local MAIL_ITEM_INDEX, mailTimer, inventoryFull, inventoryFullSoundPlayed, opening, lastSync, numCurrentMail, numHiddenMail, continue;
+local MAIL_ITEM_INDEX, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue;
 
 function mod:OnInitialize()
 	local defaults = {
@@ -36,7 +36,7 @@
 
 function mod:OnEnable()
 	self:RegisterEvent("MAIL_SHOW");
-
+	
 	if not self.btnOpenAll then
 		-- Open all button
 		local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate")
@@ -88,6 +88,7 @@
 	self.timeLeftFrame:Show();
 	
 	-- Go through all children of the mail frame to find QA's element and hide it
+	-- There's no other way to do this because QuickAuctions has a local referrence to it (not as a property of the object like most other frames)
 	local kids = { MailFrame:GetChildren() };
 	
 	for _, child in ipairs(kids) do
@@ -121,6 +122,7 @@
 	end
 	
 	-- Go through all children of the mail frame to find QA's elements and SHOW these
+	-- There's no other way to do this because QuickAuctions has a local referrence to it (not as a property of the object like most other frames)
 	local kids = { MailFrame:GetChildren() };
 	
 	for _, child in ipairs(kids) do
@@ -136,6 +138,8 @@
 	self:Debug("MAIL_SHOW");
 	
 	self:StopOpening(false);
+
+	inventoryFullSoundPlayedThisVisit = nil;
 	
 	if MailOpener.PostalEnabled then
 		-- Disable Postal's openers so we can do it ourselves
@@ -226,9 +230,10 @@
 			inventoryFull = true;
 			
 			-- Play the sound
-			if MailOpener.db.profile.notifications.bagsFullSound and (not MailOpener.db.profile.notifications.bagsFullSoundOnlyOnce or not inventoryFullSoundPlayed) then
+			if MailOpener.db.profile.notifications.bagsFullSound and (not MailOpener.db.profile.notifications.bagsFullSoundOnlyOnce or not inventoryFullSoundPlayed) and (not MailOpener.db.profile.notifications.bagsFullSoundOnlyOncePerMailboxVisit or not inventoryFullSoundPlayedThisVisit) then
 				PlaySoundFile(MailOpener.db.profile.notifications.bagsFullSoundFile);
 				inventoryFullSoundPlayed = true;
+				inventoryFullSoundPlayedThisVisit = true;
 			end
 		end