mun/plugins/identification-freenode.lua

32 lines
901 B
Lua
Raw Normal View History

local Map = {}
local Pending = {}
plugin.AddHook('auth.GetAccount', 'GetAccount', function(IRC, Username)
if Map[Username] == nil then
if not Pending[Username] then
2013-11-28 10:55:44 +00:00
-- create and event and wait for it
local Event = plugin.NewEvent()
Pending[Username] = Event
IRC:Whois(Username)
end
2013-11-28 10:55:44 +00:00
return Pending[Username]:Wait()
end
return Map[Username]
end)
plugin.AddHook('irc.GetResponse330', 'WHOISResponse', function(_, Username, Account, Message)
Map[Username] = Account
2013-11-28 10:55:44 +00:00
if Pending[Username] ~= nil then
Pending[Username]:Fire(Account)
end
end)
2013-11-28 10:55:44 +00:00
--[[ 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
2013-11-28 10:55:44 +00:00
end) ]]--