mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Added a topic-sync configurable for determining whether or not the bot should relay topic changes.
This commit is contained in:
parent
7f7562ef42
commit
c6d77bb923
@ -114,7 +114,10 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||||||
configurables = configurable.Dictionary(
|
configurables = configurable.Dictionary(
|
||||||
[('color', configurable.BoolType, True,
|
[('color', configurable.BoolType, True,
|
||||||
"""Determines whether the bot will color relayed PRIVMSGs so as to
|
"""Determines whether the bot will color relayed PRIVMSGs so as to
|
||||||
make the messages easier to read."""),]
|
make the messages easier to read."""),
|
||||||
|
('topic-sync', configurable.BoolType, True,
|
||||||
|
"""Determines whether the bot will synchronize topics between
|
||||||
|
networks in the channels it relays.""")]
|
||||||
)
|
)
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
@ -591,10 +594,13 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||||||
irc = irc.getRealIrc()
|
irc = irc.getRealIrc()
|
||||||
if msg.nick == irc.nick:
|
if msg.nick == irc.nick:
|
||||||
return
|
return
|
||||||
newTopic = msg.args[1]
|
(channel, newTopic) = msg.args
|
||||||
network = self.abbreviations[irc]
|
network = self.abbreviations[irc]
|
||||||
s = 'topic change by %s on %s: %s' % (msg.nick, network, newTopic)
|
if self.configurables.get('topic-sync', channel):
|
||||||
m = ircmsgs.privmsg(msg.args[0], s)
|
m = ircmsgs.topic(channel, newTopic)
|
||||||
|
else:
|
||||||
|
s = 'topic change by %s on %s: %s' %(msg.nick,network,newTopic)
|
||||||
|
m = ircmsgs.privmsg(channel, s)
|
||||||
self._sendToOthers(irc, m)
|
self._sendToOthers(irc, m)
|
||||||
|
|
||||||
def doQuit(self, irc, msg):
|
def doQuit(self, irc, msg):
|
||||||
@ -638,7 +644,8 @@ class Relay(callbacks.Privmsg, configurable.Mixin):
|
|||||||
if otherIrc != irc:
|
if otherIrc != irc:
|
||||||
if channel in otherIrc.state.channels:
|
if channel in otherIrc.state.channels:
|
||||||
otherIrc.queueMsg(ircmsgs.privmsg(channel, s))
|
otherIrc.queueMsg(ircmsgs.privmsg(channel, s))
|
||||||
elif msg.command == 'TOPIC' and len(msg.args) > 1:
|
elif msg.command == 'TOPIC' and len(msg.args) > 1 and \
|
||||||
|
self.configurables.get('topic-sync', msg.args[0]):
|
||||||
(channel, topic) = msg.args
|
(channel, topic) = msg.args
|
||||||
if channel in self.channels:
|
if channel in self.channels:
|
||||||
for otherIrc in self.ircs.itervalues():
|
for otherIrc in self.ircs.itervalues():
|
||||||
|
Loading…
Reference in New Issue
Block a user