Topic: Fix previous commit.

This commit is contained in:
Valentin Lorentz 2013-08-17 19:51:17 +00:00
parent 410472c317
commit 43f1e5cd24
1 changed files with 9 additions and 13 deletions

View File

@ -184,7 +184,7 @@ class Topic(callbacks.Plugin):
except (KeyError, IndexError): except (KeyError, IndexError):
return None return None
def _formatTopics(self, irc, channel, topics, isDo=False, fit=False): def _formatTopics(self, irc, channel, topics, fit=False):
topics = [s for s in topics if s and not s.isspace()] topics = [s for s in topics if s and not s.isspace()]
self.lastTopics[channel] = topics self.lastTopics[channel] = topics
newTopic = self._joinTopic(channel, topics) newTopic = self._joinTopic(channel, topics)
@ -203,20 +203,16 @@ class Topic(callbacks.Plugin):
Raise=True) Raise=True)
except KeyError: except KeyError:
pass pass
return newTopics return newTopic
def _sendTopics(self, irc, channel, topics=None, *args, newTopic=None, def _sendTopics(self, irc, channel, topics=None, isDo=False, fit=False):
**kwargs): if isinstance(topics, list) or isinstance(topics, tuple):
if newTopic is None:
assert topics is None
newTtopic = self.formatTopics(irc, channel, topics, *args,
**kwargs)
else:
assert topics is not None assert topics is not None
topics = self._formatTopics(irc, channel, topics, fit)
self._addUndo(channel, topics) self._addUndo(channel, topics)
if not isDo and channel in self.redos: if not isDo and channel in self.redos:
del self.redos[channel] del self.redos[channel]
irc.queueMsg(ircmsgs.topic(channel, newTopic)) irc.queueMsg(ircmsgs.topic(channel, topics))
irc.noReply() irc.noReply()
def _checkManageCapabilities(self, irc, msg, channel): def _checkManageCapabilities(self, irc, msg, channel):
@ -264,9 +260,9 @@ class Topic(callbacks.Plugin):
self.log.debug('No topic to auto-restore in %s.', channel) self.log.debug('No topic to auto-restore in %s.', channel)
else: else:
newTopic = self._formatTopics(irc, channel, topics) newTopic = self._formatTopics(irc, channel, topics)
if c.topic == '' or (c.topic != newTopic and if c.topic == '' or (c.topic != newTopic and
self.registryValue('alwaysSetOnJoin', channel)): self.registryValue('alwaysSetOnJoin', channel)):
self._sendTopics(irc, channel, newTopic=newTopic) self._sendTopics(irc, channel, newTopic)
def do332(self, irc, msg): def do332(self, irc, msg):
if msg.args[1] in self.watchingFor332: if msg.args[1] in self.watchingFor332: