support "0" kickrejoin delay without creating a timer
This commit is contained in:
parent
f9d13dc373
commit
21fa2120df
1 changed files with 9 additions and 3 deletions
|
@ -25,9 +25,15 @@ class Module(ModuleManager.BaseModule):
|
||||||
def on_kick(self, event):
|
def on_kick(self, event):
|
||||||
if self._should_rejoin(event["server"], event["channel"]):
|
if self._should_rejoin(event["server"], event["channel"]):
|
||||||
delay = self._get_delay(event["server"], event["channel"])
|
delay = self._get_delay(event["server"], event["channel"])
|
||||||
self.timers.add("kick-rejoin", delay, server=event["server"],
|
if delay == 0:
|
||||||
channel_name=event["channel"].name)
|
self._rejoin(event["server"], event["channel"].name)
|
||||||
|
else:
|
||||||
|
self.timers.add("kick-rejoin", delay, server=event["server"],
|
||||||
|
channel_name=event["channel"].name)
|
||||||
|
|
||||||
@utils.hook("timer.kick-rejoin")
|
@utils.hook("timer.kick-rejoin")
|
||||||
def timer(self, event):
|
def timer(self, event):
|
||||||
event["server"].send_join(event["channel_name"])
|
self._rejoin(event["server"], event["channel_name"])
|
||||||
|
|
||||||
|
def _rejoin(self, server, channel_name):
|
||||||
|
server.send_join(channel_name)
|
||||||
|
|
Loading…
Reference in a new issue