changeset 46:1805df31794d

Only when holding the shift key while opening the mailbox will toggle the opening status. If you want to do it somewhere in the middle of your mailbox visit, just untick the mail opener checkbox. Holding shift while clicking the open all button will now auto loot every single mail with attachments. /mo d will now return the id of the chatframe being used, if it's using one already existing. Changelog and TOC update.
author Zerotorescue
date Sun, 12 Sep 2010 16:36:18 +0200
parents e9072491dc3f
children 1243c2d2b85e
files Changelog.txt Core.lua MailOpener.toc Modules/Config.lua Modules/OpenAll.lua
diffstat 5 files changed, 48 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/Changelog.txt	Sun Sep 12 15:53:19 2010 +0200
+++ b/Changelog.txt	Sun Sep 12 16:36:18 2010 +0200
@@ -3,7 +3,12 @@
 M Modified
 ! New functionality
 
-v1.1.1		Zerotorescue		Sat, 12 Sep 2010 01:30:00 +0200		rev 42
+v1.1.2		Zerotorescue		Sun, 12 Sep 2010 16:30:00 +0200		rev 46
+	
+	! Holding shift while clicking the open all button will now auto loot every single mail with attachments.
+	M Only when holding the shift key while opening the mailbox will toggle the opening status. If you want to do it somewhere in the middle of your mailbox visit, just untick the mail opener checkbox.
+
+v1.1.1		Zerotorescue		Sun, 12 Sep 2010 01:30:00 +0200		rev 42
 	
 	! Added a new option to both of the current sound notifications to limit playing of the sound to once per mailbox visit, instead of once per mailbox refresh / bags update.
 	M Now using more standardized prefixes for changes.
--- a/Core.lua	Sun Sep 12 15:53:19 2010 +0200
+++ b/Core.lua	Sun Sep 12 16:36:18 2010 +0200
@@ -368,6 +368,13 @@
 		self.cbOpenAll:SetChecked(false);
 	end
 	
+	if IsShiftKeyDown() then
+		print("|cff15ff00Mail Opener|r: |cffff0000Disabling|r automatic opening of mail, shift key was down when opening the mailbox.");
+		
+		AutoOpenMail = false;
+		self.cbOpenAll:SetChecked(false);
+	end
+	
 	self:ToggleQAStatus();
 	
 	-- Hide the InboxTooMuchMail warning to allow room for our mail remaining info line
@@ -458,12 +465,8 @@
 		end, 61);
 		self:Debug("tmrRecheck 61");
 		
-		if not IsShiftKeyDown() then
-			-- Allow overriding of mailopening with the shift key
-			
-			-- Open the current mail
-			self:ScheduleOpen(false);
-		end
+		-- Open the current mail
+		self:ScheduleOpen(false);
 	elseif currentMailWithAttachments < tempLastAmount then
 		-- We lost a mail
 		
@@ -474,12 +477,8 @@
 		-- Yell that we successfully opened/removed a mail
 		self:SendMessage("MO_MAIL_EMPTIED");
 	elseif (currentMailWithAttachments == 50 and tempLastAmount == 50) then
-		if not IsShiftKeyDown() then
-			-- Allow overriding of mailopening with the shift key
-			
-			-- Open the current mail
-			self:ScheduleOpen(false);
-		end
+		-- Open the current mail
+		self:ScheduleOpen(false);
 	end
 end
 
--- a/MailOpener.toc	Sun Sep 12 15:53:19 2010 +0200
+++ b/MailOpener.toc	Sun Sep 12 16:36:18 2010 +0200
@@ -2,7 +2,7 @@
 ## Title: Mail Opener
 ## Notes: This addon will automatically retrieve all your mail from the mailbox.
 ## Author: Zerotorescue
-## Version: 1.1.1
+## Version: 1.1.2
 ## SavedVariables: MailOpenerDB
 ## LoadManagers: AddonLoader
 ## X-LoadOn-Slash: /mo, /mailopen, /mailopener
--- a/Modules/Config.lua	Sun Sep 12 15:53:19 2010 +0200
+++ b/Modules/Config.lua	Sun Sep 12 16:36:18 2010 +0200
@@ -41,7 +41,7 @@
 			if name:upper() == "DEBUG" then
 				MailOpener.debugChannel = _G["ChatFrame" .. i];
 			
-				print("A debug channel already exists, used the old one.");
+				print("A debug channel already exists, used the old one. (" .. i .. ")");
 				return;
 			end
 		end
--- a/Modules/OpenAll.lua	Sun Sep 12 15:53:19 2010 +0200
+++ b/Modules/OpenAll.lua	Sun Sep 12 16:36:18 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, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue;
+local MAIL_ITEM_INDEX, MAIL_OPEN_EVERYTHING, mailTimer, inventoryFull, inventoryFullSoundPlayed, inventoryFullSoundPlayedThisVisit, opening, lastSync, numCurrentMail, numHiddenMail, continue;
 
 function mod:OnInitialize()
 	local defaults = {
@@ -39,12 +39,14 @@
 	
 	if not self.btnOpenAll then
 		-- Open all button
-		local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate")
-		button:SetText("Open all")
-		button:SetHeight(26)
-		button:SetWidth(120)
-		button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165)
-		button:SetScript("OnClick", function() mod:Open(true) end)
+		local button = CreateFrame("Button", "btnMailOpenerOpenAll", InboxFrame, "UIPanelButtonTemplate");
+		button:SetText("Open all");
+		button:SetHeight(26);
+		button:SetWidth(120);
+		button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165);
+		button:SetScript("OnClick", function()
+			mod:Open(true, IsShiftKeyDown());
+		end);
 		
 		self.btnOpenAll = button;
 	end
@@ -247,8 +249,8 @@
 	end
 end
 
-function mod:Open(forced)
-	self:Debug("Open");
+function mod:Open(forced, everything)
+	self:Debug("Open (" .. ((everything and "1") or "0") .. ")");
 	
 	if not opening or forced == true then
 		local numItems, totalItems = GetInboxNumItems();
@@ -267,6 +269,14 @@
 			
 			-- Update the caret
 			MAIL_ITEM_INDEX = newMailItemIndex;
+			-- Do we want to override filters and open every single mail?
+			if everything then
+				MAIL_OPEN_EVERYTHING = true;
+				
+				print("|cff15ff00Mail Opener|r: Shift key was held while pressing the open all button. Temporarily overriding filters; going to open every mail with attachments.");
+			else
+				MAIL_OPEN_EVERYTHING = nil;
+			end
 			
 			-- We're now going to be busy again
 			self:SetOpeningStatus(true);
@@ -349,7 +359,7 @@
 				end
 			end
 			
-			if inventoryFull and not MailOpener.db.profile.general.continueOpeningStackableItems and items and items > 0 then
+			if inventoryFull and not MAIL_OPEN_EVERYTHING 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
 					print("Skipping " .. index .. ": " .. subject .. " (inventory is full)");
 				end
@@ -383,7 +393,7 @@
 					mailType = "AH" .. auctionMailType;
 				end
 				
-				if not self.db.profile.filter.normalMoney and mailType == "normalGoldMail" then
+				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
 						print("Skipping " .. index .. ": " .. subject .. " (normal mail with gold)");
 					end
@@ -391,7 +401,7 @@
 					self:OpenNext();
 					
 					return;
-				elseif not self.db.profile.filter.normalAttachments and mailType == "normalItemsMail" then
+				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
 						print("Skipping " .. index .. ": " .. subject .. " (normal mail with attachments)");
 					end
@@ -399,7 +409,7 @@
 					self:OpenNext();
 					
 					return;
-				elseif not self.db.profile.filter.AH.expired and mailType == "AHexpired" then
+				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
 						print("Skipping " .. index .. ": " .. subject .. " (expired auction)");
 					end
@@ -407,7 +417,7 @@
 					self:OpenNext();
 					
 					return;
-				elseif not self.db.profile.filter.AH.success and mailType == "AHsuccess" then
+				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
 						print("Skipping " .. index .. ": " .. subject .. " (successful auction)");
 					end
@@ -415,7 +425,7 @@
 					self:OpenNext();
 					
 					return;
-				elseif not self.db.profile.filter.AH.won and mailType == "AHwon" then
+				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
 						print("Skipping " .. index .. ": " .. subject .. " (auction won)");
 					end
@@ -423,7 +433,7 @@
 					self:OpenNext();
 					
 					return;
-				elseif not self.db.profile.filter.AH.canceled and mailType == "AHcanceled" then
+				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
 						print("Skipping " .. index .. ": " .. subject .. " (canceled auction)");
 					end
@@ -431,7 +441,7 @@
 					self:OpenNext();
 					
 					return;
-				elseif not self.db.profile.filter.AH.outbid and mailType == "AHoutbid" then
+				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
 						print("Skipping " .. index .. ": " .. subject .. " (outbid on auction)");
 					end
@@ -610,6 +620,8 @@
 	
 	-- Reset opener position
 	MAIL_ITEM_INDEX = 0;
+	-- Reset open everything state
+	MAIL_OPEN_EVERYTHING = nil;
 	-- Stopped opening, so allow to continue
 	continue = true;