From cb9f187f80250ed522031ef3efba866a9171e9ce Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Fri, 4 Nov 2016 20:20:21 +0100
Subject: degesch: get rid of Lua timer hooks
Since they were the exception and have been replaced with the async API.
---
plugins/degesch/auto-rejoin.lua | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
(limited to 'plugins/degesch')
diff --git a/plugins/degesch/auto-rejoin.lua b/plugins/degesch/auto-rejoin.lua
index 3caa6ea..8abdb66 100644
--- a/plugins/degesch/auto-rejoin.lua
+++ b/plugins/degesch/auto-rejoin.lua
@@ -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)
--
cgit v1.2.3-70-g09d2