comparison Modules/Utils.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 bbcf81868171
children bbba2fae0f69
comparison
equal deleted inserted replaced
5:7d0f4ebedf8c 6:5dddd73b2220
5 AceConsole:Embed(addon) 5 AceConsole:Embed(addon)
6 6
7 addonTable.utils = addon 7 addonTable.utils = addon
8 8
9 function addon:FormatMoney(money) 9 function addon:FormatMoney(money)
10 return Altoholic:GetMoneyString(money, WHITE, false) 10 local prefix = ""
11 if money < 0 then
12 prefix = "-"
13 end
14 return prefix .. Altoholic:GetMoneyString(abs(money), WHITE, false)
15 end
16
17 local SubjectPatterns = {
18 AHCancelled = gsub(AUCTION_REMOVED_MAIL_SUBJECT, "%%s", ".*"),
19 AHExpired = gsub(AUCTION_EXPIRED_MAIL_SUBJECT, "%%s", ".*"),
20 AHOutbid = gsub(AUCTION_OUTBID_MAIL_SUBJECT, "%%s", ".*"),
21 AHSuccess = gsub(AUCTION_SOLD_MAIL_SUBJECT, "%%s", ".*"),
22 AHWon = gsub(AUCTION_WON_MAIL_SUBJECT, "%%s", ".*"),
23 CODPayment = gsub(COD_PAYMENT, "%%s", "(.*)"),
24 }
25
26 function addon:GetMailType(msgSubject)
27 if msgSubject then
28 for k, v in pairs(SubjectPatterns) do
29 if msgSubject:find(v) then return k end
30 end
31 end
32 return "NonAHMail"
11 end 33 end
12 34
13 function addon:tcount(tab) 35 function addon:tcount(tab)
14 local n = #tab 36 local n = #tab
15 if (n == 0) then 37 if (n == 0) then