aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-11-04 20:20:21 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2016-11-04 20:21:46 +0100
commitcb9f187f80250ed522031ef3efba866a9171e9ce (patch)
tree8c82d19391a563f6a49b1a0fbd9ad23f9b597054 /plugins
parent0247c4667a8c63c8f657f4c782fdd4a591c1e1d0 (diff)
downloadxK-cb9f187f80250ed522031ef3efba866a9171e9ce.tar.gz
xK-cb9f187f80250ed522031ef3efba866a9171e9ce.tar.xz
xK-cb9f187f80250ed522031ef3efba866a9171e9ce.zip
degesch: get rid of Lua timer hooks
Since they were the exception and have been replaced with the async API.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/degesch/auto-rejoin.lua6
1 files changed, 4 insertions, 2 deletions
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)