diff --git a/RelayNext/config.py b/RelayNext/config.py index d87125f..81bcce4 100644 --- a/RelayNext/config.py +++ b/RelayNext/config.py @@ -61,5 +61,11 @@ conf.registerChannelValue(RelayNext, 'noHighlight', registry.Boolean(False, _("""Determines whether the bot should prefix nicks with a hyphen (-) to prevent excess highlights (in PRIVMSGs and actions)."""))) +conf.registerGroup(RelayNext, 'events') + +_events = ('quit', 'join', 'part', 'nick', 'mode', 'kick') +for ev in _events: + conf.registerChannelValue(RelayNext.events, 'relay%ss' % ev, + registry.Boolean(True, """Determines whether the bot should relay %ss.""" % ev)) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/RelayNext/plugin.py b/RelayNext/plugin.py index 179545a..fcfe0fd 100644 --- a/RelayNext/plugin.py +++ b/RelayNext/plugin.py @@ -231,19 +231,25 @@ class RelayNext(callbacks.Plugin): def doPrivmsg(self, irc, msg): self.relay(irc, msg) - doJoin = doPart = doKick = doMode = doPrivmsg + def doJoin(self, irc, msg): + if self.registryValue("events.relay%ss" % msg.command, msg.args[0]): + self.relay(irc, msg) + + doPart = doKick = doMode = doJoin # NICK and QUIT aren't channel specific, so they require a bit # of extra handling def doNick(self, irc, msg): newnick = msg.args[0] for channel in self._getAllRelaysForNetwork(irc): - if newnick in irc.state.channels[channel].users: + if self.registryValue("events.relaynicks", channel) and \ + newnick in irc.state.channels[channel].users: self.relay(irc, msg, channel=channel) def doQuit(self, irc, msg): for channel in self._getAllRelaysForNetwork(irc): try: - if msg.nick in self.ircstates[irc].channels[channel].users: + if self.registryValue("events.relayquits", channel) and \ + msg.nick in self.ircstates[irc].channels[channel].users: self.relay(irc, msg, channel=channel) except Exception as e: self.log.debug("RelayNext: something happened while handling a quit:"