diff Modules/OpenAll.lua @ 31:90d58723ac0a

- Removed all BeanCounter checks in files. + Added a new module: BeanCounter Support. This module will now take care of preventing mail opening while BeanCounter is scanning. + Added AceHook library for the BeanCounter Support module. ~ Sorted the Core.lua OnInitialize to properly toggle modules before doing time consuming things. ~ All module comments are now a property of the modules themselves and can be retrieved with (string)?.moduleDescription? and (bool)?.moduleRequired?. ~ All module references are now called ?mod?. ! Added a new config group: Modules. This group will show the module statuses and descriptions and it will contain all optional modules (with their settings) as subgroups. - Removed all libraries from the repository.
author Zerotorescue
date Fri, 10 Sep 2010 18:59:58 +0200
parents d52e64bd048f
children b79bb7b449c3
line wrap: on
line diff
--- a/Modules/OpenAll.lua	Thu Sep 09 22:16:50 2010 +0200
+++ b/Modules/OpenAll.lua	Fri Sep 10 18:59:58 2010 +0200
@@ -1,18 +1,17 @@
 local MailOpener = LibStub("AceAddon-3.0"):GetAddon("MailOpener");
-local OpenAll = MailOpener:NewModule("OpenAll", "AceEvent-3.0", "AceTimer-3.0");
+local mod = MailOpener:NewModule("OpenAll", "AceEvent-3.0", "AceTimer-3.0");
+
+mod.moduleDescription = "The actual mail opening initiated by the core.";
+mod.moduleRequired = true;
 
 --[[
-Module name:	OpenAll
-Description:	The actual mail opening initiated by the core.
-Required:		Yes.
-
 Dev notes:
 When shift clicking the Open All button it should override all filters.
 ]]
 
 local MAIL_ITEM_INDEX, mailTimer, inventoryFull, inventoryFullSoundPlayed, opening, lastSync, numCurrentMail, numHiddenMail, continue;
 
-function OpenAll:OnInitialize()
+function mod:OnInitialize()
 	local defaults = {
 		profile = {
 			speed = 0.05,
@@ -35,7 +34,7 @@
 	self.db = MailOpener.db:RegisterNamespace("OpenAll", defaults);
 end
 
-function OpenAll:OnEnable()
+function mod:OnEnable()
 	self:RegisterEvent("MAIL_SHOW");
 
 	if not self.btnOpenAll then
@@ -45,7 +44,7 @@
 		button:SetHeight(26)
 		button:SetWidth(120)
 		button:SetPoint("BOTTOM", InboxFrame, "CENTER", -10, -165)
-		button:SetScript("OnClick", function() OpenAll:Open(true) end)
+		button:SetScript("OnClick", function() mod:Open(true) end)
 		
 		self.btnOpenAll = button;
 	end
@@ -103,7 +102,7 @@
 	end
 end
 
-function OpenAll:OnDisable()
+function mod:OnDisable()
 	self:UnregisterEvent("MAIL_SHOW");
 	
 	if self.btnOpenAll then
@@ -133,7 +132,7 @@
 	self:Stop();
 end
 
-function OpenAll:MAIL_SHOW()
+function mod:MAIL_SHOW()
 	self:Debug("MAIL_SHOW");
 	
 	self:StopOpening(false);
@@ -164,7 +163,7 @@
 	self:UpdateTimer();
 end
 
-function OpenAll:Stop()
+function mod:Stop()
 	self:Debug("Stop");
 	
 	-- We shutdown, so nothing to do when the mailbox is closed anymore
@@ -186,10 +185,10 @@
 	self:SetOpeningStatus(false);
 end
 
-function OpenAll:MO_SERVER_SYNCED()
+function mod:MO_SERVER_SYNCED()
 	self:Debug("MO_SERVER_SYNCED");
 	
-	-- Stop opening now to prevent the opener from continue while Beancounter is counting
+	-- Stop opening now to prevent the opener from continueing while BeanCounter is counting
 	self:StopOpening(false);
 	
 	lastSync = GetTime();
@@ -197,21 +196,21 @@
 	self:UpdateMailCount();
 end
 
-function OpenAll:MO_MAIL_EMPTIED()
+function mod:MO_MAIL_EMPTIED()
 	-- A mail has been processed so we can process the next
 	continue = true;
 	
 	self:UpdateTimer();
 end
 
-function OpenAll:UpdateMailCount()
+function mod:UpdateMailCount()
 	local numItems, totalItems = GetInboxNumItems();
 	
 	numCurrentMail = numItems;
 	numHiddenMail = ( totalItems - numItems );
 end
 
-function OpenAll:BAG_UPDATE()
+function mod:BAG_UPDATE()
 	-- If the bags are updated we should check if the inventory is full again
 	inventoryFull = false;
 	-- Replay sound
@@ -219,7 +218,7 @@
 end
 
 -- We registered this event to look for the inventory full error message because this is faster than counting the amount of items in the inventory all the time
-function OpenAll:UI_ERROR_MESSAGE(e, errorMessage)
+function mod:UI_ERROR_MESSAGE(e, errorMessage)
 	if errorMessage == ERR_INV_FULL then
 		-- Inventory is full.
 		
@@ -243,7 +242,7 @@
 	end
 end
 
-function OpenAll:Open(forced)
+function mod:Open(forced)
 	self:Debug("Open");
 	
 	if not opening or forced == true then
@@ -290,7 +289,7 @@
 	success = AUCTION_SOLD_MAIL_SUBJECT:replace("%s", ""),
 	won = AUCTION_WON_MAIL_SUBJECT:replace("%s", ""),
 };
-function OpenAll:GetAuctionMailType(subject)
+function mod:GetAuctionMailType(subject)
 	if subject then
 		-- Check if any of our patterns match, sorted by most likely matches first (if one is true the rest shouldn't be evaluated)
 		if subject:find(knownAHSubjectPatterns.expired) then
@@ -309,7 +308,7 @@
 	return; -- not auction mail
 end
 
-function OpenAll:OpenMail(index)
+function mod:OpenMail(index)
 	if index > 0 then
 		-- LUA arrays start at 1, so mail with index 0 doesn't exist, so we're finished
 		
@@ -485,7 +484,7 @@
 	end
 end
 
-function OpenAll:OpenNext()
+function mod:OpenNext()
 	if continue then
 		-- If the previous mail was opened successful, open the next
 		
@@ -501,7 +500,7 @@
 	end
 end
 
-function OpenAll:Continue()
+function mod:Continue()
 	continue = true;
 	self:OpenNext();
 end
@@ -516,7 +515,7 @@
 	soon = "|cffffffff%d|r/|cffffffff%d|r mail remaining - everything will be opened soon...";
 };
 
-function OpenAll:UpdateTimer()
+function mod:UpdateTimer()
 	if lastSync then
 		self:UpdateMailCount();
 		
@@ -591,7 +590,7 @@
 	end
 end
 
-function OpenAll:StopOpening(simple)
+function mod:StopOpening(simple)
 	-- Stop opener timer
 	self:CancelTimer(self.tmrMailOpener, true);
 	
@@ -608,10 +607,11 @@
 	MAIL_ITEM_INDEX = 0;
 	-- Stopped opening, so allow to continue
 	continue = true;
+	
 	self:SetOpeningStatus(false);
 end
 
-function OpenAll:SetOpeningStatus(openingStatus)
+function mod:SetOpeningStatus(openingStatus)
 	opening = openingStatus;
 	
 	if openingStatus then
@@ -621,7 +621,7 @@
 	end
 end
 
-function OpenAll:GetOptionsGroup()
+function mod:GetOptionsGroup()
 	local configGroup = {
 		order = 300,
 		type = "group",
@@ -844,6 +844,6 @@
 	return configGroup;
 end
 
-function OpenAll:Debug(t)
+function mod:Debug(t)
 	return MailOpener:Debug("|cff00ff00OpenAll|r:" .. t);
 end
\ No newline at end of file