1
0
mirror of https://github.com/ShadowNinja/LuaIRC.git synced 2024-11-13 05:50:33 +01:00

Adding ability for hooks to return, and OnRaw hook

By adding the ability for hooks to return, we can stop the processing of a line at any point.
This is used by the OnRaw hook such that any non-nil return value will cause the irc library to assume that line has been handled.
This commit is contained in:
Joshua Simmons 2010-07-17 23:19:07 +10:00
parent bb020fdad4
commit 9977943966

View File

@ -163,7 +163,10 @@ end
function meta:think()
while true do
local line = getline(self, 3)
if line then self:handle(parse(line))
if line then
if not self:invoke("OnRaw", line) then
self:handle(parse(line))
end
else
break
end
@ -288,7 +291,7 @@ end
function meta:handle(prefix, cmd, params)
local handler = handlers[cmd]
if handler then
handler(self, prefix, unpack(params))
return handler(self, prefix, unpack(params))
end
end