Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
Robin Hüskes | 774259923f | |
Robin Hüskes | 9eed60acf2 |
|
@ -1,5 +1,5 @@
|
|||
--[[ $Id: CallbackHandler-1.0.lua 1284 2022-09-25 09:15:30Z nevcairiel $ ]]
|
||||
local MAJOR, MINOR = "CallbackHandler-1.0", 7
|
||||
--[[ $Id: CallbackHandler-1.0.lua 26 2022-12-12 15:09:39Z nevcairiel $ ]]
|
||||
local MAJOR, MINOR = "CallbackHandler-1.0", 8
|
||||
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR)
|
||||
|
||||
if not CallbackHandler then return end -- No upgrade needed
|
||||
|
@ -7,21 +7,16 @@ if not CallbackHandler then return end -- No upgrade needed
|
|||
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end}
|
||||
|
||||
-- Lua APIs
|
||||
local error = error
|
||||
local securecallfunction, error = securecallfunction, error
|
||||
local setmetatable, rawget = setmetatable, rawget
|
||||
local next, select, pairs, type, tostring = next, select, pairs, type, tostring
|
||||
|
||||
local xpcall = xpcall
|
||||
|
||||
local function errorhandler(err)
|
||||
return geterrorhandler()(err)
|
||||
end
|
||||
|
||||
local function Dispatch(handlers, ...)
|
||||
local index, method = next(handlers)
|
||||
if not method then return end
|
||||
repeat
|
||||
xpcall(method, errorhandler, ...)
|
||||
securecallfunction(method, ...)
|
||||
index, method = next(handlers, index)
|
||||
until not method
|
||||
end
|
||||
|
|
6
core.lua
6
core.lua
|
@ -60,6 +60,7 @@ local function checkRoster(self, dummy, event, ...)
|
|||
if(res['connected'] and res['name']) then
|
||||
newroster[res['name']] = true
|
||||
end
|
||||
res = nil
|
||||
end
|
||||
end
|
||||
friendroster = newroster
|
||||
|
@ -80,7 +81,9 @@ local function checkRoster(self, dummy, event, ...)
|
|||
if(aci['isOnline'] and aci['characterName'] and not dontShow) then
|
||||
newroster[aci['characterName']] = true
|
||||
end
|
||||
aci = nil
|
||||
end
|
||||
res = nil
|
||||
end
|
||||
end
|
||||
bnetroster = newroster
|
||||
|
@ -98,7 +101,6 @@ local function OnUpdate()
|
|||
GuildRoster()
|
||||
checkRoster(nil, nil, "FRIENDLIST_UPDATE")
|
||||
checkRoster(nil, nil, "BN_FRIEND_INFO_CHANGED")
|
||||
C_Timer.After(updateDelay, OnUpdate)
|
||||
end
|
||||
child['specs'] = {
|
||||
['name'] = childName,
|
||||
|
@ -115,6 +117,6 @@ child['specs'] = {
|
|||
function events:PLAYER_ENTERING_WORLD(event)
|
||||
child:UnregisterEvent('PLAYER_ENTERING_WORLD')
|
||||
child:RegisterEvent({"GUILD_ROSTER_UPDATE","FRIENDLIST_UPDATE","CHAT_MSG_CHANNEL_JOIN","CHAT_MSG_CHANNEL_LEAVE","PLAYER_FLAGS_CHANGED","UNIT_FLAGS","BN_FRIEND_INFO_CHANGED"}, checkRoster)
|
||||
OnUpdate()
|
||||
C_Timer.NewTimer (updateDelay, OnUpdate)
|
||||
end
|
||||
child:NewAddOn(...)
|
Loading…
Reference in New Issue