From d5653077d3225d281020059b7c9ae4fafee7fa28 Mon Sep 17 00:00:00 2001 From: James Vega Date: Thu, 19 May 2005 17:23:31 +0000 Subject: [PATCH] plugins/Topic: Fix a bug with Topic.set where setting topic 1 would set the entire topic. --- plugins/Topic/plugin.py | 4 ++-- plugins/Topic/test.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/Topic/plugin.py b/plugins/Topic/plugin.py index e18042c52..6e2ab2fa5 100644 --- a/plugins/Topic/plugin.py +++ b/plugins/Topic/plugin.py @@ -315,14 +315,14 @@ class Topic(callbacks.Plugin): sets the entire topic. is only necessary if the message isn't sent in the channel itself. """ - if number: + if number is not None: topics = self._splitTopic(irc.state.getTopic(channel), channel) topics[number] = topic else: topics = [topic] self._sendTopics(irc, channel, topics) set = wrap(set, ['canChangeTopic', - optional('topicNumber', 0), + optional('topicNumber'), rest(('topic', False))]) def remove(self, irc, msg, args, channel, number): diff --git a/plugins/Topic/test.py b/plugins/Topic/test.py index cefbc98f0..d3299a4a7 100644 --- a/plugins/Topic/test.py +++ b/plugins/Topic/test.py @@ -132,6 +132,8 @@ class TopicTestCase(ChannelPluginTestCase): self.assertRegexp('topic set -1 bar', 'bar') self.assertNotRegexp('topic set -1 baz', 'bar') self.assertResponse('topic set foo bar baz', 'foo bar baz') + # Catch a bug we had where setting topic 1 would reset the whole topic + self.assertNotResponse('topic set 1 bar', 'bar') def testUndo(self): try: