3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-23 19:19:31 +01:00

relay: check service bot status before remote user presence

add_persistent_channels() is usable regardless of whether the service bot is ready, so we do not need to break if the remote copy of the service bot doesn't exist.

Closes #606.
This commit is contained in:
James Lu 2018-05-09 21:44:04 -07:00
parent f3c2149d7a
commit b50ae89acc

View File

@ -728,16 +728,19 @@ def relay_joins(irc, channel, users, ts, targetirc=None, **kwargs):
continue
assert user in irc.users, "(%s) relay.relay_joins: How is this possible? %r isn't in our user database." % (irc.name, user)
# Special case for service bots: mark the channel is persistent so that it is joined
# when the service bot is next ready. This can be done regardless of whether the remote
# client exists at this stage.
sbot = irc.get_service_bot(user)
if sbot:
sbot.add_persistent_channel(remoteirc, 'relay', remotechan, try_join=False)
u = get_remote_user(irc, remoteirc, user, reuse_sid=rsid)
if not u:
continue
# Join the service bot on the remote channel persistently.
sbot = irc.get_service_bot(user)
if sbot:
sbot.add_persistent_channel(remoteirc, 'relay', remotechan, try_join=False)
if (remotechan not in remoteirc.channels) or u not in remoteirc.channels[remotechan].users:
# Note: only join users if they aren't already joined. This prevents op floods
# on charybdis from repeated SJOINs sent for one user.