diff Modules/OpenAll.lua @ 106:5c06ce56297a

Only announce mail skipped the first OpenAll after a server refresh.
author Zerotorescue
date Thu, 30 Sep 2010 14:30:02 +0200
parents 0a8e4a93316d
children 981c6ac45a3f
line wrap: on
line diff
--- a/Modules/OpenAll.lua	Mon Sep 27 17:22:02 2010 +0200
+++ b/Modules/OpenAll.lua	Thu Sep 30 14:30:02 2010 +0200
@@ -10,7 +10,7 @@
 When shift clicking the Open All button it should override all filters.
 ]]
 
-local MAIL_ITEM_INDEX, MAIL_OPEN_EVERYTHING, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue;
+local MAIL_ITEM_INDEX, MAIL_OPEN_EVERYTHING, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue, firstOpenThisSync;
 
 function mod:OnInitialize()
 	local defaults = {
@@ -308,6 +308,9 @@
 	lastSync = GetTime();
 	
 	self:UpdateMailCount();
+	
+	-- While this is true, we'll announce mail skipped - will be set to false after opening happened once
+	firstOpenThisSync = true;
 end
 
 function mod:MO_MAIL_EMPTIED()
@@ -370,6 +373,9 @@
 			
 			-- Stop the previous opening and restart
 			if forced == true then
+				-- Show skips again
+				firstOpenThisSync = true;
+				
 				self:StopOpening(false); -- this is not a "simple" stop, so also reset inventory full warning
 			else
 				self:StopOpening(true); -- forced is false - automated action - simple reset, skip inventory full reset to avoid sound spam
@@ -440,11 +446,13 @@
 		
 		if not subject then subject = ""; end
 		
+		local onlyShowOnceCheck = firstOpenThisSync;
+		
 		local skippingString = L["Skipping %d: %s (%s)"];
 		
 		if isGM then
 			-- Blizzard Mail
-			if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.GMMail then
+			if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.GMMail then
 				print(skippingString:format(index, subject, L["Blizzard mail"]));
 			end
 			
@@ -453,7 +461,7 @@
 			return;
 		elseif cod and cod > 0 then
 			-- Cost on delivery
-			if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.COD then
+			if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.COD then
 				print(skippingString:format(index, subject, L["C.O.D."]));
 			end
 			
@@ -480,7 +488,7 @@
 			-- and not MAIL_OPEN_EVERYTHING
 			-- Removed above part from below if statement, I forgot why I put it here and now it makes no sense
 			if inventoryFull and not MailOpener.db.profile.general.continueOpeningStackableItems and items and items > 0 then
-				if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.inventoryFull then
+				if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.inventoryFull then
 					print(skippingString:format(index, subject, L["inventory is full"]));
 				end
 				
@@ -488,7 +496,7 @@
 				
 				return;
 			elseif self.db.profile.keepFreeSpace > 0 and items and slotsAvailable ~= nil and slotsAvailable <= 0 then
-				if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then
+				if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then
 					print(skippingString:format(index, subject, L["keep free space limit"]));
 				end
 				
@@ -514,7 +522,7 @@
 				end
 				
 				if not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.normalMoney and mailType == "normalGoldMail" then
-					if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
+					if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
 						print(skippingString:format(index, subject, L["normal mail with gold"]));
 					end
 					
@@ -522,7 +530,7 @@
 					
 					return;
 				elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.normalAttachments and mailType == "normalItemsMail" then
-					if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
+					if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
 						print(skippingString:format(index, subject, L["normal mail with attachments"]));
 					end
 					
@@ -530,7 +538,7 @@
 					
 					return;
 				elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.expired and mailType == "AHexpired" then
-					if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
+					if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
 						print(skippingString:format(index, subject, L["expired auction"]));
 					end
 					
@@ -538,7 +546,7 @@
 					
 					return;
 				elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.success and mailType == "AHsuccess" then
-					if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
+					if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
 						print(skippingString:format(index, subject, L["successful auction"]));
 					end
 					
@@ -546,7 +554,7 @@
 					
 					return;
 				elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.won and mailType == "AHwon" then
-					if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
+					if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
 						print(skippingString:format(index, subject, L["auction won"]));
 					end
 					
@@ -554,7 +562,7 @@
 					
 					return;
 				elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.canceled and mailType == "AHcanceled" then
-					if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
+					if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
 						print(skippingString:format(index, subject, L["canceled auction"]));
 					end
 					
@@ -562,7 +570,7 @@
 					
 					return;
 				elseif not MAIL_OPEN_EVERYTHING and not self.db.profile.filter.AH.outbid and mailType == "AHoutbid" then
-					if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped[mailType] then
+					if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped[mailType] then
 						print(skippingString:format(index, subject, L["outbid on auction"]));
 					end
 					
@@ -595,7 +603,7 @@
 									slotsAvailable = ( slotsAvailable - 1 );
 								else
 									-- No more room available, announce and go to next item
-									if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then
+									if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit then
 										print(skippingString:format(index, subject, L["keep free space limit"]));
 									end
 									
@@ -627,7 +635,7 @@
 			end
 		else
 			-- Unknown, probably just text
-			if MailOpener.db.profile.notifications.skipped.all and MailOpener.db.profile.notifications.skipped.other then
+			if MailOpener.db.profile.notifications.skipped.all and onlyShowOnceCheck and MailOpener.db.profile.notifications.skipped.other then
 				print(L["Skipping %d: %s"]:format(index, subject));
 			end
 			
@@ -635,10 +643,13 @@
 		end
 	else
 		-- Finished!
-		if MailOpener.db.profile.notifications.finishedCurrentBatch then
+		if MailOpener.db.profile.notifications.finishedCurrentBatch and firstOpenThisSync then
 			print(L["Finished opening the current batch."]);
 		end
 		
+		-- We have opened mail once this batch, so quit notifying
+		firstOpenThisSync = nil;
+		
 		self:SetOpeningStatus(false);
 		
 		self:Debug("MO_OPEN_COMPLETE");