mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Topic plugin: Restore topic automatically after join if not set.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
parent
6520d1f282
commit
18ef6dadfc
@ -232,6 +232,21 @@ class Topic(callbacks.Plugin):
|
|||||||
# We're joining a channel, let's watch for the topic.
|
# We're joining a channel, let's watch for the topic.
|
||||||
self.watchingFor332.add(msg.args[0])
|
self.watchingFor332.add(msg.args[0])
|
||||||
|
|
||||||
|
def do315(self, irc, msg):
|
||||||
|
# Try to restore the topic when not set yet.
|
||||||
|
channel = msg.args[1]
|
||||||
|
c = irc.state.channels[channel]
|
||||||
|
if irc.nick not in c.ops and 't' in c.modes:
|
||||||
|
self.log.debug('Not trying to restore topic in %s. I\'m not opped '
|
||||||
|
'and %s is +t.', channel, channel)
|
||||||
|
return
|
||||||
|
if c.topic == '':
|
||||||
|
try:
|
||||||
|
topics = self.lastTopics[channel]
|
||||||
|
self._sendTopics(irc, channel, topics)
|
||||||
|
except KeyError:
|
||||||
|
self.log.debug('No topic to auto-restore in %s.', channel)
|
||||||
|
|
||||||
def do332(self, irc, msg):
|
def do332(self, irc, msg):
|
||||||
if msg.args[1] in self.watchingFor332:
|
if msg.args[1] in self.watchingFor332:
|
||||||
self.watchingFor332.remove(msg.args[1])
|
self.watchingFor332.remove(msg.args[1])
|
||||||
|
Loading…
Reference in New Issue
Block a user