From a0ad55c2cdc2cea152377d14b910ea80292b193d Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Thu, 24 May 2012 10:05:48 +0200 Subject: [PATCH] Topic: Add save command. Closes GH-332. I committed this already earlier, but that commit was lost somewhere. It doesn't seem to be in any branch, I suspect I might have reset my testing branch or something later, or I don't know. --- plugins/Topic/plugin.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugins/Topic/plugin.py b/plugins/Topic/plugin.py index b7f2c599d..20bd5389f 100644 --- a/plugins/Topic/plugin.py +++ b/plugins/Topic/plugin.py @@ -573,6 +573,24 @@ class Topic(callbacks.Plugin): self._sendTopics(irc, channel, topics) swap = wrap(swap, ['canChangeTopic', 'topicNumber', 'topicNumber']) + @internationalizeDocstring + def save(self, irc, msg, args, channel): + """[] + + Saves the topic in to be restored with @topic default + later. is only necessary if the message isn't sent in + the channel itself. + """ + if not self._checkManageCapabilities(irc, msg, channel): + capabilities = self.registryValue('requireManageCapability') + irc.errorNoCapability(capabilities, Raise=True) + topic = irc.state.getTopic(channel) + if topic: + self.setRegistryValue('default', value=topic, channel=channel) + else: + self.setRegistryValue('default', value='', channel=channel) + save = wrap(save, ['canChangeTopic']) + @internationalizeDocstring def default(self, irc, msg, args, channel): """[]