mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-30 23:09:23 +01:00
relay: only join users once, returning if there are no queued users at all
Closes #71, prevents op floods on multiple SJOIN being sent. Also, this squashes AssertionErrors raised by protocol modules in sjoinServer, when we try to join zero users to a channel!
This commit is contained in:
parent
7daa595a7b
commit
b681a675eb
@ -663,13 +663,19 @@ def relayJoins(irc, channel, users, ts, modes):
|
|||||||
log.debug('Okay, spawning %s/%s everywhere', user, irc.name)
|
log.debug('Okay, spawning %s/%s everywhere', user, irc.name)
|
||||||
assert user in irc.users, "(%s) How is this possible? %r isn't in our user database." % (irc.name, user)
|
assert user in irc.users, "(%s) How is this possible? %r isn't in our user database." % (irc.name, user)
|
||||||
u = getRemoteUser(irc, remoteirc, user)
|
u = getRemoteUser(irc, remoteirc, user)
|
||||||
ts = irc.channels[channel].ts
|
# Only join users if they aren't already joined. This prevents op floods
|
||||||
# TODO: join users in batches with SJOIN, not one by one.
|
# on charybdis from all the SJOINing.
|
||||||
prefixes = getPrefixModes(irc, remoteirc, channel, user)
|
if u not in remoteirc.channels[channel].users:
|
||||||
userpair = (prefixes, u)
|
ts = irc.channels[channel].ts
|
||||||
queued_users.append(userpair)
|
prefixes = getPrefixModes(irc, remoteirc, channel, user)
|
||||||
log.debug('(%s) relayJoins: joining %s to %s%s', irc.name, userpair, remoteirc.name, remotechan)
|
userpair = (prefixes, u)
|
||||||
remoteirc.proto.sjoinServer(remoteirc, remoteirc.sid, remotechan, queued_users, ts=ts)
|
queued_users.append(userpair)
|
||||||
|
log.debug('(%s) relayJoins: joining %s to %s%s', irc.name, userpair, remoteirc.name, remotechan)
|
||||||
|
else:
|
||||||
|
log.debug('(%s) relayJoins: not joining %s to %s%s; they\'re already there!', irc.name,
|
||||||
|
u, remoteirc.name, remotechan)
|
||||||
|
if queued_users:
|
||||||
|
remoteirc.proto.sjoinServer(remoteirc, remoteirc.sid, remotechan, queued_users, ts=ts)
|
||||||
relayModes(irc, remoteirc, irc.sid, channel, modes)
|
relayModes(irc, remoteirc, irc.sid, channel, modes)
|
||||||
|
|
||||||
def relayPart(irc, channel, user):
|
def relayPart(irc, channel, user):
|
||||||
|
Loading…
Reference in New Issue
Block a user