From 1166866ffd856ddf30a41c7731d4b60aa8b26d54 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 12 Dec 2014 11:06:24 -0800 Subject: [PATCH] Topic: allow toggling automatic topic setting via config --- plugins/Topic/config.py | 6 +++++- plugins/Topic/plugin.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/Topic/config.py b/plugins/Topic/config.py index 008fd6c40..d18ac546d 100644 --- a/plugins/Topic/config.py +++ b/plugins/Topic/config.py @@ -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 diff --git a/plugins/Topic/plugin.py b/plugins/Topic/plugin.py index 1908b7aac..1419d3cc8 100644 --- a/plugins/Topic/plugin.py +++ b/plugins/Topic/plugin.py @@ -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 '