diff --git a/plugins/relay.py b/plugins/relay.py index 07eaaf9..8201048 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -663,13 +663,19 @@ def relayJoins(irc, channel, users, ts, modes): 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) u = getRemoteUser(irc, remoteirc, user) - ts = irc.channels[channel].ts - # TODO: join users in batches with SJOIN, not one by one. - prefixes = getPrefixModes(irc, remoteirc, channel, user) - userpair = (prefixes, u) - queued_users.append(userpair) - log.debug('(%s) relayJoins: joining %s to %s%s', irc.name, userpair, remoteirc.name, remotechan) - remoteirc.proto.sjoinServer(remoteirc, remoteirc.sid, remotechan, queued_users, ts=ts) + # Only join users if they aren't already joined. This prevents op floods + # on charybdis from all the SJOINing. + if u not in remoteirc.channels[channel].users: + ts = irc.channels[channel].ts + prefixes = getPrefixModes(irc, remoteirc, channel, user) + userpair = (prefixes, u) + 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) def relayPart(irc, channel, user):