diff Core.lua @ 118:13243f627bf4 v1.2.5

ZA compatability fix.
author Zerotorescue
date Tue, 12 Oct 2010 12:44:45 +0200
parents cff956d6e9d0
children b21c39ea338c
line wrap: on
line diff
--- a/Core.lua	Tue Oct 12 11:39:52 2010 +0200
+++ b/Core.lua	Tue Oct 12 12:44:45 2010 +0200
@@ -296,8 +296,9 @@
 		if AddonLoader and AddonLoader.LoadAddOn then
 			AddonLoader:LoadAddOn("QuickAuctions");
 		end
-	elseif select(6, GetAddOnInfo("ZeroAuctions")) == nil then
-		self.QuickAuctionsEnabled = true; -- Set this as an object variable so we can use it in our modules
+	end
+	if select(6, GetAddOnInfo("ZeroAuctions")) == nil then
+		self.ZeroAuctionsEnabled = true; -- Set this as an object variable so we can use it in our modules
 		
 		-- Ensure this addon is loaded if AddonLoader is installed
 		if AddonLoader and AddonLoader.LoadAddOn then
@@ -311,7 +312,7 @@
 	
 	-- ADJUST POSITIONS
 	
-	if self.QuickAuctionsEnabled then
+	if self.QuickAuctionsEnabled or self.ZeroAuctionsEnabled then
 		-- QA is enabled so move the checkbox further to the right
 		
 		self.cbOpenAll:SetPoint("TOPLEFT", MailFrame, "TOPLEFT", 155, -13);
@@ -438,22 +439,24 @@
 	InboxTooMuchMail.Show = function() end
 	
 	if self.QuickAuctionsEnabled then
-		local QAMail = LibStub("AceAddon-3.0"):GetAddon("QuickAuctions", true):GetModule("Mail", true);
+		local QAMail = LibStub("AceAddon-3.0"):GetAddon("QuickAuctions", true):GetModule("Mail", true)
 		
 		if QAMail then
 			-- Hide the open all button
 			QAMail.massOpening:Hide();
 			-- Hide the x mail remaining text
 			QAMail.totalMail:Hide();
-		else
-			local ZAMail = LibStub("AceAddon-3.0"):GetAddon("ZeroAuctions", true):GetModule("Mail", true);
-			
-			if ZAMail then
-				-- Hide the open all button
-				ZAMail.massOpening:Hide();
-				-- Hide the x mail remaining text
-				ZAMail.totalMail:Hide();
-			end
+		end
+	end
+	
+	if self.ZeroAuctionsEnabled then
+		local QAMail = LibStub("AceAddon-3.0"):GetAddon("ZeroAuctions", true):GetModule("Mail", true)
+		
+		if QAMail then
+			-- Hide the open all button
+			QAMail.massOpening:Hide();
+			-- Hide the x mail remaining text
+			QAMail.totalMail:Hide();
 		end
 	end
 	
@@ -570,10 +573,14 @@
 			
 			self:CancelTimer(self.tmrTryAgain, true); -- Insurance
 			
-			if QuickAuctionsAutoMail then
+			if self.QuickAuctionsEnabled and QuickAuctionsAutoMail then
 				-- Remember the last known quick auctions status
 				lastQuickAuctionsStatus = QuickAuctionsAutoMail:GetChecked();
 			end
+			if self.ZeroAuctionsEnabled and ZeroAuctionsAutoMail then
+				-- Remember the last known quick auctions status
+				lastQuickAuctionsStatus = ZeroAuctionsAutoMail:GetChecked();
+			end
 			if self.db.profile.general.autoDisableQAAutoMail and self.QuickAuctionsEnabled and QuickAuctionsAutoMail and QuickAuctionsAutoMail:GetChecked() then
 				-- If auto disable "QA Auto mail" is enabled and QA's auto mail is currently toggled on, turn it off
 				-- We need to do this with a :click to trigger the right events
@@ -582,6 +589,15 @@
 				
 				QuickAuctionsAutoMail:Click();
 			end
+			if self.db.profile.general.autoDisableQAAutoMail and self.ZeroAuctionsEnabled and ZeroAuctionsAutoMail and ZeroAuctionsAutoMail:GetChecked() then
+				-- If auto disable "QA Auto mail" is enabled and QA's auto mail is currently toggled on, turn it off
+				-- We need to do this with a :click to trigger the right events
+				
+				self:Debug("Turning automail |cffff0000off|r.");
+				
+				ZeroAuctionsAutoMail:Click();
+			end
+			
 			
 			MailAddonBusy = self:GetName();
 			
@@ -647,6 +663,31 @@
 		end
 	end
 	
+	if self.ZeroAuctionsEnabled then
+		-- Zero Auctions enabled?
+		-- Toggle automailing as per settings
+		
+		if self.db.profile.general.autoReenableQAAutoMail and ZeroAuctionsAutoMail and not ZeroAuctionsAutoMail:GetChecked() then
+			-- If auto re-enable "QA Auto mail" is enabled and QA's auto mail is currently toggled OFF, turn it on
+			-- We need to do this with a :click to trigger the right events
+			
+			self:Debug("Turning automail |cff00ff00on|r.");
+			
+			ZeroAuctionsAutoMail:Click();
+		elseif self.db.profile.general.autoSetBackQAAutoMail and ZeroAuctionsAutoMail and lastQuickAuctionsStatus ~= ZeroAuctionsAutoMail:GetChecked() then
+			-- If auto set back "QA Auto mail" is enabled and QA's auto mail is currently not the same as it was before starting, toggle it
+			-- We need to do this with a :click to trigger the right events
+			
+			if lastQuickAuctionsStatus then
+				self:Debug("Turning automail |cff00ff00on|r.");
+			else
+				self:Debug("Turning automail |cffff0000off|r.");
+			end
+				
+			ZeroAuctionsAutoMail:Click();
+		end
+	end
+	
 	if self.db.profile.general.continueOpening then
 		self:ScheduleOpen(true);
 	end
@@ -764,6 +805,17 @@
 			QuickAuctionsAutoMail:Click();
 		end
 	end
+	if self.ZeroAuctionsEnabled and self.db.profile.general.defaultQAStatus ~= "__remember" and ZeroAuctionsAutoMail then
+		if self.db.profile.general.defaultQAStatus == "_enabled" and not ZeroAuctionsAutoMail:GetChecked() then
+			self:Debug("Turning automail |cff00ff00on|r.");
+			
+			ZeroAuctionsAutoMail:Click();
+		elseif self.db.profile.general.defaultQAStatus == "disabled" and ZeroAuctionsAutoMail:GetChecked() then
+			self:Debug("Turning automail |cffff0000off|r.");
+			
+			ZeroAuctionsAutoMail:Click();
+		end
+	end
 end
 
 function MailOpener:FormatMoney(copper)