From 2e4c9439b95ec0c4f38f7d7109a2c8c3fe2f2d88 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 29 Aug 2003 07:32:14 +0000 Subject: [PATCH] Changed topicUnformatter regexp slightly and fixed shuffletopic so it wouldn't send a repeat topic. --- plugins/Topic.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/Topic.py b/plugins/Topic.py index 7edbfebca..7d054d226 100644 --- a/plugins/Topic.py +++ b/plugins/Topic.py @@ -67,7 +67,7 @@ example = utils.wrapLines(""" class Topic(callbacks.Privmsg): topicSeparator = ' || ' topicFormatter = '%s (%s)' - topicUnformatter = re.compile('(.*) \((.*)\)') + topicUnformatter = re.compile('(.*) \((\S+)\)') def addtopic(self, irc, msg, args): """[] @@ -106,9 +106,11 @@ class Topic(callbacks.Privmsg): channel = privmsgs.getChannel(msg, args) capability = ircdb.makeChannelCapability(channel, 'topic') if ircdb.checkCapability(msg.prefix, capability): - topics = irc.state.getTopic(channel).split(self.topicSeparator) - random.shuffle(topics) - newtopic = self.topicSeparator.join(topics) + newtopic = irc.state.getTopic(channel) + while newtopic = irc.state.getTopic(channel): + topics = irc.state.getTopic(channel).split(self.topicSeparator) + random.shuffle(topics) + newtopic = self.topicSeparator.join(topics) irc.queueMsg(ircmsgs.topic(channel, newtopic)) else: irc.error(msg, conf.replyNoCapability % capability)