Merge pull request #943 from GLolol/topic-1

Topic: allow toggling automatic topic setting via config
This commit is contained in:
Valentin Lorentz 2014-12-12 20:18:45 +01:00
commit f65d742fee
2 changed files with 6 additions and 2 deletions

View File

@ -61,9 +61,13 @@ conf.registerChannelValue(Topic, 'recognizeTopiclen',
conf.registerChannelValue(Topic, 'default',
registry.String('', _("""Determines what the default topic for the channel
is. This is used by the default command to set this topic.""")))
conf.registerChannelValue(Topic, 'setOnJoin',
registry.Boolean(True, _("""Determines whether the bot will automatically
set the topic on join if it is empty.""")))
conf.registerChannelValue(Topic, 'alwaysSetOnJoin',
registry.Boolean(False, _("""Determines whether the bot will set the topic
every time it joins, or only if the topic is empty.""")))
every time it joins, or only if the topic is empty. Requires 'config
plugins.topic.setOnJoin' to be set to True.""")))
conf.registerGroup(Topic, 'undo')
conf.registerChannelValue(Topic.undo, 'max',
registry.NonNegativeInteger(10, _("""Determines the number of previous

View File

@ -250,7 +250,7 @@ class Topic(callbacks.Plugin):
# Try to restore the topic when not set yet.
channel = msg.args[1]
c = irc.state.channels.get(channel)
if c is None:
if c is None or not self.registryValue('setOnJoin', channel):
return
if irc.nick not in c.ops and 't' in c.modes:
self.log.debug('Not trying to restore topic in %s. I\'m not opped '