ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Mail API (https://www.esoui.com/forums/showthread.php?t=4399)

Argusus 03/09/15 09:42 AM

Mail API
 
Is there a way to "track" a mailed could if it's accepted or declined? Example if I cod someone something and they accept or decline, is there a way to track it? I'm wanting to do some functionality when someone accepts my cod, I save the information about the mail. I know mailr tracks sent mails but I'm looking to basically match up a send and receive response.

Would I use "getnextmailid" then store that number and check to see if the mail received back matches the number returned from "getnextmailid"?

Baertram 03/09/15 02:38 PM

Ok, as your threads are duplicate I'll answer you here and remove the other post in your old thread:

I only know of the following EVENTS that trigger upon incoming emails or interaction with the MAIL_INBOX:

Lua Code:
  1. EVENT_MAIL_INBOX_UPDATE
  2. EVENT_MAIL_READABLE
  3. EVENT_MAIL_TAKE_ATTACHED_ITEM_SUCCESS
  4. EVENT_MAIL_TAKE_ATTACHED_MONEY_SUCCESS
  5. EVENT_MAIL_REMOVED
  6. EVENT_MAIL_NUM_UNREAD_CHANGED

You could use EVENT_MAIL_READBALE e.g. and register a new callback function and check the incoming COD amount by help of the mail id.

Or you Pre-hook this function here to above to get the COD amount:
Lua Code:
  1. function ZO_MailInboxShared_PopulateMailData(dataTable, mailId)
  2.     local senderDisplayName, senderCharacterName, subject, icon, unread, fromSystem, fromCS, returned, numAttachments, attachedMoney, codAmount, expiresInDays, secsSinceReceived = GetMailItemInfo(mailId)
  3.     dataTable.mailId = mailId
  4.     dataTable.subject = subject
  5.     dataTable.returned = returned
  6.     dataTable.senderDisplayName = senderDisplayName
  7.     dataTable.senderCharacterName = senderCharacterName
  8.     dataTable.expiresInDays = expiresInDays
  9.     dataTable.unread = unread
  10.     dataTable.numAttachments = numAttachments
  11.     dataTable.attachedMoney = attachedMoney
  12.     dataTable.codAmount = codAmount
  13.     dataTable.secsSinceReceived = secsSinceReceived
  14.     dataTable.fromSystem = fromSystem
  15.     dataTable.fromCS = fromCS
  16.     dataTable.priority = fromCS and 1 or 2
  17.     dataTable.GetFormattedSubject = GetFormattedSubject
  18.     dataTable.GetExpiresText = GetExpiresText
  19.     dataTable.GetReceivedText = GetReceivedText
  20. end

If it is 0 the other one did not accept it, I guesss.

I'm not sure if the MailID is the same as the send one but would make sense I guess.

Argusus 03/09/15 02:56 PM

Thanks for your response, I will have to test out and see if the getnextmailid is indeed the correct mail id for the response when EVENT_MAIL_READABLE and it passes the mail id that was selected , if so this would work. Just really wanting to be able to establish/find a relationship between a send and reply. With out comparing title or something else.



Quote:

Originally Posted by Baertram (Post 19416)
Ok, as your threads are duplicate I'll answer you here and remove the other post in your old thread:

I only know of the following EVENTS that trigger upon incoming emails or interaction with the MAIL_INBOX:

Lua Code:
  1. EVENT_MAIL_INBOX_UPDATE
  2. EVENT_MAIL_READABLE
  3. EVENT_MAIL_TAKE_ATTACHED_ITEM_SUCCESS
  4. EVENT_MAIL_TAKE_ATTACHED_MONEY_SUCCESS
  5. EVENT_MAIL_REMOVED
  6. EVENT_MAIL_NUM_UNREAD_CHANGED

You could use EVENT_MAIL_READBALE e.g. and register a new callback function and check the incoming COD amount by help of the mail id.

Or you Pre-hook this function here to above to get the COD amount:
Lua Code:
  1. function ZO_MailInboxShared_PopulateMailData(dataTable, mailId)
  2.     local senderDisplayName, senderCharacterName, subject, icon, unread, fromSystem, fromCS, returned, numAttachments, attachedMoney, codAmount, expiresInDays, secsSinceReceived = GetMailItemInfo(mailId)
  3.     dataTable.mailId = mailId
  4.     dataTable.subject = subject
  5.     dataTable.returned = returned
  6.     dataTable.senderDisplayName = senderDisplayName
  7.     dataTable.senderCharacterName = senderCharacterName
  8.     dataTable.expiresInDays = expiresInDays
  9.     dataTable.unread = unread
  10.     dataTable.numAttachments = numAttachments
  11.     dataTable.attachedMoney = attachedMoney
  12.     dataTable.codAmount = codAmount
  13.     dataTable.secsSinceReceived = secsSinceReceived
  14.     dataTable.fromSystem = fromSystem
  15.     dataTable.fromCS = fromCS
  16.     dataTable.priority = fromCS and 1 or 2
  17.     dataTable.GetFormattedSubject = GetFormattedSubject
  18.     dataTable.GetExpiresText = GetExpiresText
  19.     dataTable.GetReceivedText = GetReceivedText
  20. end

If it is 0 the other one did not accept it, I guesss.

I'm not sure if the MailID is the same as the send one but would make sense I guess.


Baertram 03/11/15 01:20 PM

If you find out please share your research info with us. Thanks


All times are GMT -6. The time now is 01:36 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI