From ecf52180b04144df35059c29bf8f0918ccd15c2e Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 19 Dec 2020 23:35:01 +0100 Subject: [PATCH] RelayNext: make channel a mandatory argument to relay() Messages where this is not set correctly are thrown away anyways. --- RelayNext/plugin.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/RelayNext/plugin.py b/RelayNext/plugin.py index b0e4eb1..f880738 100644 --- a/RelayNext/plugin.py +++ b/RelayNext/plugin.py @@ -237,8 +237,8 @@ class RelayNext(callbacks.Plugin): s = "\x02[%s]\x02 %s" % (netname, s) return s - def relay(self, irc, msg, channel=None): - channel = (channel or msg.args[0]).lower() + def relay(self, irc, msg, channel): + channel = channel.lower() self.log.debug("RelayNext (%s): got channel %s", irc.network, channel) if not channel in irc.state.channels: return @@ -345,11 +345,12 @@ class RelayNext(callbacks.Plugin): otherIrc.queueMsg(out_msg) def doPrivmsg(self, irc, msg): - self.relay(irc, msg) + self.relay(irc, msg, channel=msg.args[0]) def doNonPrivmsg(self, irc, msg): - if self.registryValue("events.relay%ss" % msg.command, msg.args[0]): - self.relay(irc, msg) + channel = msg.args[0] + if self.registryValue("events.relay%ss" % msg.command, channel): + self.relay(irc, msg, channel) doTopic = doPart = doKick = doMode = doJoin = doNonPrivmsg @@ -358,12 +359,12 @@ class RelayNext(callbacks.Plugin): def doNick(self, irc, msg): for channel in msg.tagged('channels'): if self.registryValue("events.relaynicks", channel): - self.relay(irc, msg, channel=channel) + self.relay(irc, msg, channel) def doQuit(self, irc, msg): for channel in msg.tagged('channels'): if self.registryValue("events.relayquits", channel): - self.relay(irc, msg, channel=channel) + self.relay(irc, msg, channel) def outFilter(self, irc, msg): # Catch our own messages and send them into the relay (this is