From a33f37c4e64d87b91c35ce7c12be20addd2f0d8d Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 18 Jan 2015 14:55:05 -0500 Subject: [PATCH] RelayNext: support relaying topics (turned off by default) --- RelayNext/config.py | 6 ++++-- RelayNext/plugin.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/RelayNext/config.py b/RelayNext/config.py index 3c1680a..e5a572b 100644 --- a/RelayNext/config.py +++ b/RelayNext/config.py @@ -77,10 +77,12 @@ conf.registerChannelValue(RelayNext.antiflood, 'timeout', conf.registerGroup(RelayNext, 'events') -_events = ('quit', 'join', 'part', 'nick', 'mode', 'kick') +_events = {'quit': True, 'join': True, 'part': True, + 'nick': True, 'mode': True, 'kick': True, + 'topic': False} for ev in _events: conf.registerChannelValue(RelayNext.events, 'relay%ss' % ev, - registry.Boolean(True, """Determines whether the bot should relay %ss.""" % ev)) + registry.Boolean(_events[ev], """Determines whether the bot should relay %ss.""" % ev)) conf.registerChannelValue(RelayNext.events, 'userIgnored', registry.SpaceSeparatedListOfStrings(['PRIVMSG', 'MODE'], ("""Determines what events the relay should ignore from ignored users. Ignores are added using diff --git a/RelayNext/plugin.py b/RelayNext/plugin.py index 5e66632..6f31784 100644 --- a/RelayNext/plugin.py +++ b/RelayNext/plugin.py @@ -203,6 +203,8 @@ class RelayNext(callbacks.Plugin): elif msg.command == 'MODE': modes = ' '.join(msg.args[1:]) s = '- %s%s set mode %s on %s' % (nick, userhost, modes, channel) + elif msg.command == 'TOPIC': + s = '- %s set topic on %s to: %s' % (nick, channel, msg.args[1]) if s: # Add the network name and some final touch-ups s = "\x02[%s]\x02 %s" % (netname, s) @@ -276,7 +278,7 @@ class RelayNext(callbacks.Plugin): if self.registryValue("events.relay%ss" % msg.command, msg.args[0]): self.relay(irc, msg) - doPart = doKick = doMode = doJoin + doTopic = doPart = doKick = doMode = doJoin # NICK and QUIT aren't channel specific, so they require a bit # of extra handling