diff Modules/Events.lua @ 6:5dddd73b2220

Removed dependency on postal. It was only being used to determine the mail type which has been moved into ItemAuditor so I can support CODPayments. Paying for COD items works, but getting the payments back can't reliably associate the payment with an item yet.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Wed, 26 May 2010 22:41:47 -0700
parents 7d0f4ebedf8c
children bbba2fae0f69
line wrap: on
line diff
--- a/Modules/Events.lua	Wed May 26 21:26:24 2010 -0700
+++ b/Modules/Events.lua	Wed May 26 22:41:47 2010 -0700
@@ -27,16 +27,15 @@
 function addon:MAIL_INBOX_UPDATE()
 	local newScan = addon:ScanMail()
 	local diff
-	for item, total in pairs(self.lastMailScan) do
+	for mailType, collection in pairs(self.lastMailScan) do
+		for item, total in pairs(collection) do
 
-		if newScan[item] == nil then
-			newScan[item] = 0
+			diff = total - (newScan[mailType][item] or 0)
+			if diff ~= 0 then
+				self:SaveValue(item, diff)
+			end
+
 		end
-		diff = total - newScan[item]
-		if diff ~= 0 then
-			self:SaveValue(item, diff)
-		end
-
 	end
 
 	self.lastMailScan = newScan