From 3f98af6f9604897d6142ee26b0db27163339dd34 Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 3 Aug 2015 23:22:13 -0700 Subject: [PATCH] relay: a few bugfixes - Only send messages for blocked kicks if the sender is a user - getRemoteUser: only set the .remote attribute when spawning a new user (prevents KeyErrors) - Kick handling: Check for +y too when checking whether the kicker has ops --- plugins/relay.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/relay.py b/plugins/relay.py index 31b2c1d..7e71a2f 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -150,7 +150,6 @@ def getRemoteUser(irc, remoteirc, user, spawnIfMissing=True): modes=modes, ts=userobj.ts).uid remoteirc.users[u].remote = irc.name relayusers[(irc.name, user)][remoteirc.name] = u - remoteirc.users[u].remote = irc.name return u def getLocalUser(irc, user, targetirc=None): @@ -399,7 +398,7 @@ def handle_kick(irc, source, command, args): real_target = getLocalUser(irc, target, targetirc=remoteirc) log.debug('(%s) Relay kick: kicker_modes are %r', irc.name, kicker_modes) if irc.name not in db[relay]['claim'] and not \ - any([mode in kicker_modes for mode in ('q', 'a', 'o', 'h')]): + any([mode in kicker_modes for mode in ('y', 'q', 'a', 'o', 'h')]): log.debug('(%s) Relay kick: kicker %s is not opped... We should rejoin the target user %s', irc.name, kicker, real_target) # Home network is not in the channel's claim AND the kicker is not # opped. We won't propograte the kick then. @@ -408,9 +407,10 @@ def handle_kick(irc, source, command, args): modes = getPrefixModes(remoteirc, irc, remotechan, real_target) # Join the kicked client back with its respective modes. irc.proto.sjoinServer(irc, irc.sid, remotechan, [(modes, target)]) - utils.msg(irc, kicker, "This channel is claimed; your kick has " - "to %s been blocked because you are not " - "(half)opped." % channel, notice=True) + if kicker in irc.users: + utils.msg(irc, kicker, "This channel is claimed; your kick has " + "to %s been blocked because you are not " + "(half)opped." % channel, notice=True) return # Propogate the kick!