mirror of
https://github.com/ShadowNinja/LuaIRC.git
synced 2025-01-10 01:50:26 +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:
parent
bb020fdad4
commit
9977943966
7
init.lua
7
init.lua
@ -163,7 +163,10 @@ end
|
|||||||
function meta:think()
|
function meta:think()
|
||||||
while true do
|
while true do
|
||||||
local line = getline(self, 3)
|
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
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
@ -288,7 +291,7 @@ end
|
|||||||
function meta:handle(prefix, cmd, params)
|
function meta:handle(prefix, cmd, params)
|
||||||
local handler = handlers[cmd]
|
local handler = handlers[cmd]
|
||||||
if handler then
|
if handler then
|
||||||
handler(self, prefix, unpack(params))
|
return handler(self, prefix, unpack(params))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user