aboutsummaryrefslogtreecommitdiff
path: root/plugins/degesch/auto-rejoin.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/degesch/auto-rejoin.lua')
-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)