diff Modules/Utils.lua @ 63:e7d287cc3b02

Replaced all instances of addon with ItemAuditor and I moved ItemAuditor out of the global namespace. The conversion was mostly a search/replace offering no new functionality. That will come in a later commit.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Tue, 27 Jul 2010 17:58:33 -0700
parents bdf3aba93aa9
children 32d53abee666
line wrap: on
line diff
--- a/Modules/Utils.lua	Tue Jul 27 17:52:21 2010 -0700
+++ b/Modules/Utils.lua	Tue Jul 27 17:58:33 2010 -0700
@@ -1,7 +1,7 @@
-local addonName, addonTable = ...; 
-local addon = _G[addonName]
+local ItemAuditor = select(2, ...)
+local Utils = ItemAuditor:NewModule("Utils")
 
-function addon:FormatMoney(copper, color, textOnly)
+function ItemAuditor:FormatMoney(copper, color, textOnly)
 	color = color or "|cFFFFFFFF"
 	local prefix = ""
 	if copper < 0 then
@@ -67,13 +67,13 @@
 -- This is only here to make sure this doesn't blow up if ReplaceItemCache is never called
 local item_db = {}
 
-function addon:ReplaceItemCache(new_cache)
+function ItemAuditor:ReplaceItemCache(new_cache)
 	item_db  = new_cache
 end
 
 -- This will be reset every session
 local tmp_item_cache = {}
-function addon:GetItemID(itemName)
+function ItemAuditor:GetItemID(itemName)
 	if item_db[itemName] ~= nil then
 		return item_db[itemName]
 	end
@@ -100,7 +100,7 @@
 	return tmp_item_cache[itemName]
 end
 
-function addon:GetLinkFromName(itemName)
+function ItemAuditor:GetLinkFromName(itemName)
 	local itemID = self:GetItemID(itemName)
 	local itemLink
 	if itemID ~= nil then
@@ -110,11 +110,11 @@
 	return itemLink
 end
 
-function addon:SaveItemID(itemName, id)
+function ItemAuditor:SaveItemID(itemName, id)
 	item_db[itemName] = tonumber(id)
 end
 
-addon.SubjectPatterns = {
+ItemAuditor.SubjectPatterns = {
 	AHCancelled = gsub(AUCTION_REMOVED_MAIL_SUBJECT, "%%s", ".*"),
 	AHExpired = gsub(AUCTION_EXPIRED_MAIL_SUBJECT, "%%s", ".*"),
 	AHOutbid = gsub(AUCTION_OUTBID_MAIL_SUBJECT, "%%s", ".*"),
@@ -123,7 +123,7 @@
 	CODPayment = gsub(COD_PAYMENT, "%%s", "(.*)"),
 }
 
-function addon:GetMailType(msgSubject)
+function ItemAuditor:GetMailType(msgSubject)
 	if msgSubject then
 		for k, v in pairs(self.SubjectPatterns) do
 			if msgSubject:find(v) then return k end
@@ -132,7 +132,7 @@
 	return "NonAHMail"
 end
 
-function addon:tcount(tab)
+function ItemAuditor:tcount(tab)
    local n = #tab
    if (n == 0) then
       for _ in pairs(tab) do
@@ -142,11 +142,11 @@
    return n
 end
 
-function addon:GetDebug(info)
+function ItemAuditor:GetDebug(info)
 	return self.db.char.debug
 end
 
-function addon:SetDebug(info, input)
+function ItemAuditor:SetDebug(info, input)
 	
 	ItemAuditor.db.char.debug = input
 	local value = "off"