Mercurial > wow > itemauditor
diff 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 |
line wrap: on
line diff
--- a/Modules/Utils.lua Wed May 26 21:26:24 2010 -0700 +++ b/Modules/Utils.lua Wed May 26 22:41:47 2010 -0700 @@ -7,7 +7,29 @@ addonTable.utils = addon function addon:FormatMoney(money) - return Altoholic:GetMoneyString(money, WHITE, false) + local prefix = "" + if money < 0 then + prefix = "-" + end + return prefix .. Altoholic:GetMoneyString(abs(money), WHITE, false) +end + +local SubjectPatterns = { + AHCancelled = gsub(AUCTION_REMOVED_MAIL_SUBJECT, "%%s", ".*"), + AHExpired = gsub(AUCTION_EXPIRED_MAIL_SUBJECT, "%%s", ".*"), + AHOutbid = gsub(AUCTION_OUTBID_MAIL_SUBJECT, "%%s", ".*"), + AHSuccess = gsub(AUCTION_SOLD_MAIL_SUBJECT, "%%s", ".*"), + AHWon = gsub(AUCTION_WON_MAIL_SUBJECT, "%%s", ".*"), + CODPayment = gsub(COD_PAYMENT, "%%s", "(.*)"), +} + +function addon:GetMailType(msgSubject) + if msgSubject then + for k, v in pairs(SubjectPatterns) do + if msgSubject:find(v) then return k end + end + end + return "NonAHMail" end function addon:tcount(tab)