RelayNext: support relaying topics (turned off by default)

This commit is contained in:
James Lu 2015-01-18 14:55:05 -05:00
parent 78a79fdf3d
commit a33f37c4e6
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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