remove try-rejoin (on 477) logic. will move to a module later
This commit is contained in:
parent
4c2c4a501c
commit
dadefeb8f3
3 changed files with 2 additions and 20 deletions
|
@ -247,11 +247,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
# we need a registered nickname for this channel
|
# we need a registered nickname for this channel
|
||||||
@utils.hook("raw.received.477", default_event=True)
|
@utils.hook("raw.received.477", default_event=True)
|
||||||
def handle_477(self, event):
|
def handle_477(self, event):
|
||||||
channel_name = event["server"].irc_lower(event["line"].args[1])
|
channel.handle_477(self.timers, event)
|
||||||
if not channel_name in event["server"].channels:
|
|
||||||
key = event["server"].attempted_join[channel_name]
|
|
||||||
self.timers.add("rejoin", 5, channel_name=channe_name, key=key,
|
|
||||||
server_id=event["server"].id)
|
|
||||||
|
|
||||||
# someone's been kicked from a channel
|
# someone's been kicked from a channel
|
||||||
@utils.hook("raw.received.kick")
|
@utils.hook("raw.received.kick")
|
||||||
|
|
|
@ -90,8 +90,6 @@ def join(events, event):
|
||||||
user.join_channel(channel)
|
user.join_channel(channel)
|
||||||
|
|
||||||
if is_self:
|
if is_self:
|
||||||
if channel.name in event["server"].attempted_join:
|
|
||||||
del event["server"].attempted_join[channel.name]
|
|
||||||
events.on("self.join").call(channel=channel, server=event["server"],
|
events.on("self.join").call(channel=channel, server=event["server"],
|
||||||
account=account, realname=realname)
|
account=account, realname=realname)
|
||||||
channel.send_mode()
|
channel.send_mode()
|
||||||
|
@ -132,11 +130,7 @@ def handle_329(event):
|
||||||
channel.creation_timestamp = int(event["line"].args[2])
|
channel.creation_timestamp = int(event["line"].args[2])
|
||||||
|
|
||||||
def handle_477(timers, event):
|
def handle_477(timers, event):
|
||||||
channel_name = event["server"].irc_lower(event["line"].args[1])
|
pass
|
||||||
if channel_name in event["server"].channels:
|
|
||||||
key = event["server"].attempted_join[channel_name]
|
|
||||||
timers.add("rejoin", 5, channel_name=channe_name, key=key,
|
|
||||||
server_id=event["server"].id)
|
|
||||||
|
|
||||||
def kick(events, event):
|
def kick(events, event):
|
||||||
user = event["server"].get_user(event["line"].source.nickname)
|
user = event["server"].get_user(event["line"].source.nickname)
|
||||||
|
|
|
@ -65,13 +65,9 @@ class Server(IRCObject.Object):
|
||||||
self.motd_lines = [] # type: typing.List[str]
|
self.motd_lines = [] # type: typing.List[str]
|
||||||
self.motd_done = False
|
self.motd_done = False
|
||||||
|
|
||||||
self.attempted_join = {} # type: typing.Dict[str, typing.Optional[str]]
|
|
||||||
|
|
||||||
self.ping_sent = False
|
self.ping_sent = False
|
||||||
self.send_enabled = True
|
self.send_enabled = True
|
||||||
|
|
||||||
self.events.on("timer.rejoin").hook(self.try_rejoin)
|
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return "IRCServer.Server(%s)" % self.__str__()
|
return "IRCServer.Server(%s)" % self.__str__()
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
|
@ -342,10 +338,6 @@ class Server(IRCObject.Object):
|
||||||
def send_pong(self, nonce: str) -> typing.Optional[IRCLine.SentLine]:
|
def send_pong(self, nonce: str) -> typing.Optional[IRCLine.SentLine]:
|
||||||
return self.send(utils.irc.protocol.pong(nonce), immediate=True)
|
return self.send(utils.irc.protocol.pong(nonce), immediate=True)
|
||||||
|
|
||||||
def try_rejoin(self, event: EventManager.Event):
|
|
||||||
if event["server_id"] == self.id and event["channel_name"
|
|
||||||
] in self.attempted_join:
|
|
||||||
self.send_join(event["channel_name"], [event["key"]])
|
|
||||||
def send_join(self, channel_name: str, keys: typing.List[str]=None
|
def send_join(self, channel_name: str, keys: typing.List[str]=None
|
||||||
) -> typing.Optional[IRCLine.SentLine]:
|
) -> typing.Optional[IRCLine.SentLine]:
|
||||||
return self.send(utils.irc.protocol.join(channel_name, keys))
|
return self.send(utils.irc.protocol.join(channel_name, keys))
|
||||||
|
|
Loading…
Reference in a new issue