plugins/Topic: Fix a bug with Topic.set where setting topic 1 would set the entire topic.

This commit is contained in:
James Vega 2005-05-19 17:23:31 +00:00
parent e4242ba994
commit d5653077d3
2 changed files with 4 additions and 2 deletions

View File

@ -315,14 +315,14 @@ class Topic(callbacks.Plugin):
sets the entire topic. <channel> 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):

View File

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