Fixed name tracking a bit, should be fairly complete now

This commit is contained in:
Jakob 2010-06-03 21:48:37 +02:00
parent a8211a7678
commit 009e09dae6
2 changed files with 30 additions and 0 deletions

View File

@ -33,6 +33,9 @@ end
function meta:part(channel)
self:send("PART %s", channel)
if self.track_users then
self.channels[channel] = nil
end
end
function meta:trackUsers(b)

View File

@ -170,6 +170,33 @@ handlers["PART"] = function(o, prefix, channel, reason)
o:invoke("OnPart", user, channel, reason)
end
handlers["QUIT"] = function(o, prefix, msg)
local user = parsePrefix(prefix)
if o.track_users then
for channel, v in pairs(o.channels) do
v.users[user.nick] = nil
end
end
o:invoke("OnQuit", user, msg)
end
handlers["NICK"] = function(o, prefix, newnick)
local user = parsePrefix(prefix)
if o.track_users then
for channel, v in pairs(o.channels) do
local users = v.users
local oldinfo = users[user.nick]
if oldinfo then
users[newnick] = oldinfo
users[user.nick] = nil
o:invoke("NickChange", user, newnick, channel)
end
end
else
o:invoke("NickChange", user, newnick)
end
end
--NAMES list
handlers["353"] = function(o, prefix, me, chanType, channel, names)
if o.track_users then