local Map = {} local Pending = {} plugin.AddHook('auth.GetAccount', 'GetAccount', function(IRC, Username) if Map[Username] == nil then if not Pending[Username] then -- create and event and wait for it local Event = plugin.NewEvent() Pending[Username] = Event IRC:Whois(Username) end local Status, Data = Pending[Username]:WaitTimeout(2) if Status == false then print("Timeout on getting auth event.") return nil end print("Got auth event.") return Data end return Map[Username] end) plugin.AddHook('irc.GetResponse330', 'WHOISResponse', function(_, Username, Account, Message) print("Got response for WHOIS for " .. Username .. " who is logged in as " .. Account) Map[Username] = Account if Pending[Username] ~= nil then print("...and firing event for that user: " .. Account) Pending[Username]:Fire(Account) end end) --[[ plugin.AddHook('irc.ChannelNames', 'ScanChannelUsers', function(Channel) for Nick, Member in pairs(Channel.Members) do if not Pending[Nick] then Channel:Whois(Nick) Pending[Nick] = true end end end) ]]--