Converted to use generic names.

This commit is contained in:
Jeremy Fincher 2003-10-21 04:03:25 +00:00
parent 26d41dac6e
commit 62f371d848
2 changed files with 19 additions and 19 deletions

View File

@ -67,7 +67,7 @@ class Topic(callbacks.Privmsg):
topicSeparator = ' || '
topicFormatter = '%s (%s)'
topicUnformatter = re.compile('(.*) \((\S+)\)')
def addtopic(self, irc, msg, args, channel):
def add(self, irc, msg, args, channel):
"""[<channel>] <topic>
Adds <topic> to the topics for <channel>. <channel> is only necessary
@ -90,9 +90,9 @@ class Topic(callbacks.Privmsg):
else:
newTopic = formattedTopic
irc.queueMsg(ircmsgs.topic(channel, newTopic))
addtopic = privmsgs.checkChannelCapability(addtopic, 'topic')
add = privmsgs.checkChannelCapability(add, 'topic')
def shuffletopic(self, irc, msg, args, channel):
def shuffle(self, irc, msg, args, channel):
"""[<channel>]
Shuffles the topics in <channel>. <channel> is only necessary if the
@ -106,9 +106,9 @@ class Topic(callbacks.Privmsg):
random.shuffle(topics)
newtopic = self.topicSeparator.join(topics)
irc.queueMsg(ircmsgs.topic(channel, newtopic))
shuffletopic = privmsgs.checkChannelCapability(shuffletopic, 'topic')
shuffle = privmsgs.checkChannelCapability(shuffle, 'topic')
def gettopic(self, irc, msg, args, channel):
def get(self, irc, msg, args, channel):
"""[<channel>] <number>
Returns topic number <number> from <channel>. <number> is a one-based
@ -129,9 +129,9 @@ class Topic(callbacks.Privmsg):
except IndexError:
irc.error(msg, 'That\'s not a valid topic.')
return
gettopic = privmsgs.channel(gettopic)
get = privmsgs.channel(get)
def changetopic(self, irc, msg, args, channel):
def change(self, irc, msg, args, channel):
"""[<channel>] <number> <regexp>
Changes the topic number <number> on <channel> according to the regular
@ -178,9 +178,9 @@ class Topic(callbacks.Privmsg):
topics.insert(number, newTopic)
newTopic = self.topicSeparator.join(topics)
irc.queueMsg(ircmsgs.topic(channel, newTopic))
changetopic = privmsgs.checkChannelCapability(changetopic, 'topic')
change = privmsgs.checkChannelCapability(change, 'topic')
def removetopic(self, irc, msg, args, channel):
def remove(self, irc, msg, args, channel):
"""[<channel>] <number>
Removes topic <number> from the topic for <channel> Topics are
@ -217,7 +217,7 @@ class Topic(callbacks.Privmsg):
return
newTopic = self.topicSeparator.join(topics)
irc.queueMsg(ircmsgs.topic(channel, newTopic))
removetopic = privmsgs.checkChannelCapability(removetopic, 'topic')
remove = privmsgs.checkChannelCapability(remove, 'topic')
Class = Topic

View File

@ -36,27 +36,27 @@ class TopicTestCase(PluginTestCase, PluginDocumentation):
def testAddtopic(self):
_ = self.getMsg('join #foo')
_ = self.getMsg(' ') # Get the WHO.
m = self.getMsg('addtopic #foo foo')
m = self.getMsg('topic add #foo foo')
self.assertEqual(m.command, 'TOPIC')
self.assertEqual(m.args[0], '#foo')
self.assertEqual(m.args[1], 'foo (test)')
m = self.getMsg('addtopic #foo bar')
m = self.getMsg('topic add #foo bar')
self.assertEqual(m.command, 'TOPIC')
self.assertEqual(m.args[0], '#foo')
def testChangetopic(self):
_ = self.getMsg('join #foo')
_ = self.getMsg(' ')
_ = self.getMsg('addtopic #foo foo')
_ = self.getMsg('addtopic #foo bar')
_ = self.getMsg('addtopic #foo baz')
self.assertRegexp('changetopic #foo -1 s/baz/biff/',
_ = self.getMsg('topic add #foo foo')
_ = self.getMsg('topic add #foo bar')
_ = self.getMsg('topic add #foo baz')
self.assertRegexp('topic change #foo -1 s/baz/biff/',
r'foo.*bar.*biff')
self.assertRegexp('changetopic #foo 2 s/bar/baz/',
self.assertRegexp('topic change #foo 2 s/bar/baz/',
r'foo.*baz.*biff')
self.assertRegexp('changetopic #foo 1 s/foo/bar/',
self.assertRegexp('topic change #foo 1 s/foo/bar/',
r'bar.*baz.*biff')
self.assertRegexp('changetopic #foo -2 s/baz/bazz/',
self.assertRegexp('topic change #foo -2 s/baz/bazz/',
r'bar.*bazz.*biff')