Added Topic.separator.

This commit is contained in:
Jeremy Fincher 2004-12-21 13:09:41 +00:00
parent d6136cc39e
commit c350baa2ae
3 changed files with 28 additions and 0 deletions

View File

@ -1,3 +1,7 @@
* Added a Topic.separator command, which replaces the current
separator with a new separator, changing the topic to reflect the
change.
* Changed the supybot.user configuration variable so that if it
isn't configured, the user will stay up-to-date with the current
version of the bot. To take advantage of this, set your

View File

@ -425,6 +425,17 @@ class Topic(callbacks.Privmsg):
irc.error('There is no default topic configured for %s.' % channel)
default = wrap(default, ['canChangeTopic'])
def separator(self, irc, msg, args, channel, separator):
"""[<channel>] <separator>
Sets the topic separator for <channel> to <separator> Converts the
current topic appropriately.
"""
topics = self._splitTopic(irc.state.getTopic(channel), channel)
self.setRegistryValue('separator', separator, channel)
self._sendTopics(irc, channel, topics)
separator = wrap(separator, ['canChangeTopic', 'something'])
Class = Topic

View File

@ -190,6 +190,19 @@ class TopicTestCase(ChannelPluginTestCase, PluginDocumentation):
self.assertResponse('topic', 'foo || bar')
finally:
conf.supybot.plugins.Topic.format.setValue(original)
def testSeparator(self):
original = conf.supybot.plugins.Topic.format()
try:
conf.supybot.plugins.Topic.format.setValue('$topic')
self.assertResponse('topic add foo', 'foo')
self.assertResponse('topic add bar', 'foo || bar')
self.assertResponse('topic add baz', 'foo || bar || baz')
self.assertResponse('topic separator |', 'foo | bar | baz')
self.assertResponse('topic separator ::', 'foo :: bar :: baz')
self.assertResponse('topic separator ||', 'foo || bar || baz')
finally:
conf.supybot.plugins.Topic.format.setValue(original)