From ea7681502f86abcfaef27ac01eaa9a3ecc8eadd3 Mon Sep 17 00:00:00 2001 From: James Lu Date: Tue, 21 Jul 2015 17:33:36 -0700 Subject: [PATCH] fix some bugs, introduce others --- plugins/relay.py | 3 ++- protocols/inspircd.py | 2 +- protocols/ts6.py | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/relay.py b/plugins/relay.py index a1b72f9..4b6155a 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -592,13 +592,14 @@ def relayJoins(irc, channel, users, ts, modes): # meaningless. continue 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) relayJoin: joining %s to %s%s', irc.name, userpair, remoteirc.name, remotechan) + 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) relayModes(irc, remoteirc, irc.sid, channel, modes) diff --git a/protocols/inspircd.py b/protocols/inspircd.py index f8ec8e5..d33a0cf 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -345,7 +345,7 @@ def handle_part(irc, source, command, args): return {'channels': channels, 'text': reason} def handle_error(irc, numeric, command, args): - irc.connected = False + irc.connected.clear() raise ProtocolError('Received an ERROR, killing!') def handle_fjoin(irc, servernumeric, command, args): diff --git a/protocols/ts6.py b/protocols/ts6.py index 6ef657b..c86b360 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -87,7 +87,11 @@ def sjoinServer(irc, server, channel, users, ts=None): for userpair in users: assert len(userpair) == 2, "Incorrect format of userpair: %r" % userpair prefixes, user = userpair - prefixchars = ''.join([irc.prefixmodes[prefix] for prefix in prefixes]) + prefixchars = '' + for prefix in prefixes: + pr = irc.prefixmodes.get(prefix) + if pr: + prefixchars += pr namelist.append(prefixchars+user) uids.append(user) for m in prefixes: