This commit is contained in:
Jeremy Fincher 2003-11-21 12:35:24 +00:00
parent 43c594661c
commit 0da5c27380
2 changed files with 8 additions and 1 deletions

View File

@ -122,6 +122,10 @@ class Topic(callbacks.Privmsg):
topics = self._splitTopic(irc.state.getTopic(channel)) topics = self._splitTopic(irc.state.getTopic(channel))
if topics: if topics:
try: try:
match = self.topicUnformatter.match(topics[number])
if match:
irc.reply(msg, match.group(1))
else:
irc.reply(msg, topics[number]) irc.reply(msg, topics[number])
except IndexError: except IndexError:
irc.error(msg, 'That\'s not a valid topic.') irc.error(msg, 'That\'s not a valid topic.')

View File

@ -50,8 +50,11 @@ class TopicTestCase(ChannelPluginTestCase, PluginDocumentation):
_ = self.getMsg('topic add bar') _ = self.getMsg('topic add bar')
_ = self.getMsg('topic add baz') _ = self.getMsg('topic add baz')
self.assertRegexp('topic get 1', '^foo') self.assertRegexp('topic get 1', '^foo')
self.assertNotRegexp('topic get 1', self.nick)
self.assertRegexp('topic get 2', '^bar') self.assertRegexp('topic get 2', '^bar')
self.assertNotRegexp('topic get 2', self.nick)
self.assertRegexp('topic get 3', '^baz') self.assertRegexp('topic get 3', '^baz')
self.assertNotRegexp('topic get 3', self.nick)
self.assertError('topic get 0') self.assertError('topic get 0')
def testTopicAdd(self): def testTopicAdd(self):