1
0
mirror of https://github.com/ShadowNinja/LuaIRC.git synced 2025-01-10 01:50:26 +01:00

added topic hooks

This commit is contained in:
Jakob Ovrum 2010-07-17 11:43:17 +09:00
parent 72a355cc70
commit 8f8feb00d7

View File

@ -7,8 +7,7 @@ local unpack = unpack
local pairs = pairs local pairs = pairs
local assert = assert local assert = assert
local require = require local require = require
local tonumber = tonumber
local print = print
module "irc" module "irc"
@ -217,8 +216,23 @@ handlers["366"] = function(o, prefix, me, channel, msg)
end end
end end
--no topic
handlers["331"] = function(o, prefix, me, channel)
o:invoke("OnTopic", channel, nil)
end
--new topic
handlers["TOPIC"] = function(o, prefix, channel, topic) handlers["TOPIC"] = function(o, prefix, channel, topic)
o:invoke("TopicChange", channel, topic) o:invoke("OnTopic", channel, topic)
end
handlers["332"] = function(o, prefix, me, channel, topic)
o:invoke("OnTopic", channel, topic)
end
--topic creation info
handlers["333"] = function(o, prefix, me, channel, nick, time)
o:invoke("OnTopicInfo", channel, nick, tonumber(time))
end end
handlers["ERROR"] = function(o, prefix, message) handlers["ERROR"] = function(o, prefix, message)
@ -272,3 +286,7 @@ function meta:whois(nick)
return result return result
end end
function meta:topic(channel)
self:send("TOPIC %s", channel)
end