private.lastCheckedMail = GetTime() --this keeps us from hiding the mail UI to early and causing flicker
private.lastCheckedMail = GetTime() --this keeps us from hiding the mail UI to early and causing flicker
end
end
private.mailReadOveride = {}
private.mailReadOveride = {}
private.wipeSearchCache() --clear the search cache, we are updating data so it is now outdated
private.wipeSearchCache() --clear the search cache, we are updating data so it is now outdated
end
end
function private.getInvoice(n, sender, subject)
function private.getInvoice(n, sender, subject)
if sender:match(_BC('MailAllianceAuctionHouse')) or sender:match(_BC('MailHordeAuctionHouse')) or sender:match(_BC('MailNeutralAuctionHouse')) then
if sender:match(_BC('MailAllianceAuctionHouse')) or sender:match(_BC('MailHordeAuctionHouse')) or sender:match(_BC('MailNeutralAuctionHouse')) or sender:match(_BC('MailUndercityAuctionHouse')) then
if subject:match(successLocale) or subject:match(wonLocale) then
if subject:match(successLocale) or subject:match(wonLocale) then
local invoiceType, itemName, playerName, bid, buyout, deposit, consignment = GetInboxInvoiceInfo(n)
local invoiceType, itemName, playerName, bid, buyout, deposit, consignment = GetInboxInvoiceInfo(n)
if invoiceType and playerName and playerName ~= "" and bid and bid > 0 then --Silly name throttling lead to missed invoice lookups
if invoiceType and playerName and playerName ~= "" and bid and bid > 0 then --Silly name throttling lead to missed invoice lookups
if (#private.inboxStart == 0) and (HideMailGUI == true) and (private.lastCheckedMail + 1 < GetTime() ) then --time delay added to prevent possible flicker
if (#private.inboxStart == 0) and (HideMailGUI == true) and (private.lastCheckedMail + 1 < GetTime() ) then --time delay added to prevent possible flicker
--debugPrint("Total Mail in inbox:{{", reportTotalMail, "}}Had alredy been read:{{", reportAlreadyReadMail, "}}Mails to read:{{",reportReadMail, "}}Mail from AH:{{", reportAHMail, "}}")
--debugPrint("Total Mail in inbox:{{", reportTotalMail, "}}Had alredy been read:{{", reportAlreadyReadMail, "}}Mails to read:{{",reportReadMail, "}}Mail from AH:{{", reportAHMail, "}}")
if private.reconcilePending[i]["sender"]:match(_BC('MailAllianceAuctionHouse')) or private.reconcilePending[i]["sender"]:match(_BC('MailHordeAuctionHouse')) or private.reconcilePending[i]["sender"]:match(_BC('MailNeutralAuctionHouse')) then
if private.reconcilePending[i]["sender"]:match(_BC('MailAllianceAuctionHouse')) or private.reconcilePending[i]["sender"]:match(_BC('MailHordeAuctionHouse')) or private.reconcilePending[i]["sender"]:match(_BC('MailNeutralAuctionHouse'))
or private.reconcilePending[i]["sender"]:match(_BC('MailUndercityAuctionHouse')) then
if private.reconcilePending[i].subject:match(successLocale) and (private.reconcilePending[i].retrieved == "yes" or private.reconcilePending[i].retrieved == "failed") then
if private.reconcilePending[i].subject:match(successLocale) and (private.reconcilePending[i].retrieved == "yes" or private.reconcilePending[i].retrieved == "failed") then
elseif private.reconcilePending[i].subject:match(wonLocale) and (private.reconcilePending[i].retrieved == "yes" or private.reconcilePending[i].retrieved == "failed") then
elseif private.reconcilePending[i].subject:match(wonLocale) and (private.reconcilePending[i].retrieved == "yes" or private.reconcilePending[i].retrieved == "failed") then
private.sortCompletedBidsBuyouts( i )
private.sortCompletedBidsBuyouts( i )
elseif private.reconcilePending[i].subject:match(outbidLocale) then
elseif private.reconcilePending[i].subject:match(outbidLocale) then
private.sortFailedBids( i )
private.sortFailedBids( i )
elseif private.reconcilePending[i].subject:match(cancelledLocale) then
elseif private.reconcilePending[i].subject:match(cancelledLocale) then
private.sortCancelledAuctions( i )
private.sortCancelledAuctions( i )
elseif private.reconcilePending[i].subject:match(salePendingLocale) then
elseif private.reconcilePending[i].subject:match(salePendingLocale) then
--ignore We dont care about this message
--ignore We dont care about this message
tremove(private.reconcilePending,i)
tremove(private.reconcilePending,i)
else
else
debugPrint("We had an Auction mail that failed mailsort()", private.reconcilePending[i].subject)
debugPrint("We had an Auction mail that failed mailsort()", private.reconcilePending[i].subject)
tremove(private.reconcilePending,i)
tremove(private.reconcilePending,i)
end
end
else --if its not AH do we care? We need to record cash arrival from other toons
else --if its not AH do we care? We need to record cash arrival from other toons
debugPrint("Failure for completedAuctions", itemID, itemLink, "index", private.reconcilePending[i].n)
debugPrint("Failure for completedAuctions", itemID, itemLink, "index", private.reconcilePending[i].n)
end
end
end
end
tremove(private.reconcilePending, i)
tremove(private.reconcilePending, i)
end
end
--Find the stack information in postedAuctions to add into the completedAuctions DB on mail arrivial
--Find the stack information in postedAuctions to add into the completedAuctions DB on mail arrivial
function private.findStackcompletedAuctions(key, itemID, itemLink, soldDeposit, soldBuy, soldTime)
function private.findStackcompletedAuctions(key, itemID, itemLink, soldDeposit, soldBuy, soldTime)
if not private.playerData[key][itemID] then return end --if no keys present abort
if not private.playerData[key][itemID] then return end --if no keys present abort
local soldDeposit, soldBuy, soldTime ,oldestPossible = tonumber(soldDeposit), tonumber(soldBuy), tonumber(soldTime), tonumber(soldTime - 173400) --48H 15min oldest we will go back
local soldDeposit, soldBuy, soldTime ,oldestPossible = tonumber(soldDeposit), tonumber(soldBuy), tonumber(soldTime), tonumber(soldTime - 173400) --48H 15min oldest we will go back
--ItemLink will be used minus its unique ID
--ItemLink will be used minus its unique ID
local itemString = lib.API.getItemString(itemLink)
local itemString = lib.API.getItemString(itemLink)
itemString = itemString:match("(item:.+):.-:.-")-- ignore Unique ID
itemString = itemString:match("(item:.+):.-:.-")-- ignore Unique ID
for i,v in pairs (private.playerData[key][itemID]) do
for i,v in pairs (private.playerData[key][itemID]) do
if returnedStack == tonumber(postStack) then --stacks same see if we can match time
if returnedStack == tonumber(postStack) then --stacks same see if we can match time
local timeAuctionPosted, timeFailedAuctionStarted = tonumber(postTime), tonumber(expiredTime - (postRunTime * 60)) --Time this message should have been posted
local timeAuctionPosted, timeFailedAuctionStarted = tonumber(postTime), tonumber(expiredTime - (postRunTime * 60)) --Time this message should have been posted
if (timeAuctionPosted - 7200) <= timeFailedAuctionStarted and timeFailedAuctionStarted <= (timeAuctionPosted + 7200) then
if (timeAuctionPosted - 7200) <= timeFailedAuctionStarted and timeFailedAuctionStarted <= (timeAuctionPosted + 7200) then
tremove(private.playerData[key][itemID][i], index) --remove the matched item From postedAuctions DB
tremove(private.playerData[key][itemID][i], index) --remove the matched item From postedAuctions DB
if returnedStack == tonumber(postStack) then --stacks same see if we can match time
if returnedStack == tonumber(postStack) then --stacks same see if we can match time
local timeAuctionPosted, timeCancelledAuctionStarted = tonumber(postTime), tonumber(expiredTime - (postRunTime * 60)) --Earrliest time we could have posted the auction
local timeAuctionPosted, timeCancelledAuctionStarted = tonumber(postTime), tonumber(expiredTime - (postRunTime * 60)) --Earrliest time we could have posted the auction
if (timeAuctionPosted - 7200) > (timeCancelledAuctionStarted) then --cancelled auctions could have just been posted so no way to age check beyond oldest possible
if (timeAuctionPosted - 7200) > (timeCancelledAuctionStarted) then --cancelled auctions could have just been posted so no way to age check beyond oldest possible
tremove(private.playerData[key][itemID][i], index) --remove the matched item From postedAuctions DB
tremove(private.playerData[key][itemID][i], index) --remove the matched item From postedAuctions DB
--if seller == postSeller and postBid == bid then --Seller is mostly useless thanks to blizzards item name cahce chamges. Can often be nil esp after a getall
--if seller == postSeller and postBid == bid then --Seller is mostly useless thanks to blizzards item name cahce chamges. Can often be nil esp after a getall
if postBid == bid then
if postBid == bid then
tremove(private.playerData["postedBids"][itemID][itemString], index) --remove the matched item From postedBids DB
tremove(private.playerData["postedBids"][itemID][itemString], index) --remove the matched item From postedBids DB