From 8c540b3e73ad6409b71ee8638a128409d644e426 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Fri, 17 Nov 2017 19:51:09 +0100 Subject: [PATCH] more efficient sender autocomplete update --- Mail.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Mail.lua b/Mail.lua index 33d6c4c..2e9325c 100644 --- a/Mail.lua +++ b/Mail.lua @@ -5,7 +5,7 @@ setfenv(1, setmetatable(Mail, {__index=_G})) do local f = CreateFrame'Frame' f:SetScript('OnEvent', function() Mail[event]() end) - for _, event in {'ADDON_LOADED', 'PLAYER_LOGIN', 'UI_ERROR_MESSAGE', 'CURSOR_UPDATE', 'BAG_UPDATE', 'MAIL_CLOSED', 'MAIL_SEND_SUCCESS', 'MAIL_INBOX_UPDATE'} do + for _, event in {'ADDON_LOADED', 'PLAYER_LOGIN', 'UI_ERROR_MESSAGE', 'CURSOR_UPDATE', 'BAG_UPDATE', 'MAIL_CLOSED', 'MAIL_SEND_SUCCESS'} do f:RegisterEvent(event) end end @@ -121,13 +121,12 @@ do end end -function MAIL_INBOX_UPDATE() - for i = 1, GetInboxNumItems() do - local _, _, sender, _, _, _, _, _, _, _, _, canReply = GetInboxHeaderInfo(i) - if sender and canReply then - addAutoCompleteName(sender) - end +function hook.GetInboxHeaderInfo(...) + local sender, canReply = arg[3], arg[12] + if sender and canReply then + addAutoCompleteName(sender) end + return orig.GetInboxHeaderInfo(unpack(arg)) end function ADDON_LOADED()