degesch: get rid of Lua timer hooks

Since they were the exception and have been replaced with the async API.
This commit is contained in:
2016-11-04 20:20:21 +01:00
parent 0247c4667a
commit cb9f187f80
2 changed files with 4 additions and 50 deletions

View File

@@ -32,6 +32,7 @@ degesch.setup_config {
},
}
async, await = degesch.async, coroutine.yield
degesch.hook_irc (function (hook, server, line)
local msg = degesch.parse (line)
if msg.command ~= "KICK" then return line end
@@ -39,9 +40,10 @@ degesch.hook_irc (function (hook, server, line)
local who = msg.prefix:match ("^[^!]*")
local channel, whom = table.unpack (msg.params)
if who ~= whom and whom == server.user.nickname then
degesch.hook_timer (function (hook)
async.go (function ()
await (async.timer_ms (timeout * 1000))
server:send ("JOIN " .. channel)
end, timeout * 1000)
end)
end
return line
end)