mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 14:59:34 +01:00
Made to relay topic changes.
This commit is contained in:
parent
7fe7c03d81
commit
48f71bb29c
@ -448,6 +448,13 @@ class Relay(callbacks.Privmsg):
|
|||||||
s = '%s%s@%s%s %s' % (lt, nick, network, gt, msg.args[1])
|
s = '%s%s@%s%s %s' % (lt, nick, network, gt, msg.args[1])
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
def _sendToOthers(self, irc, msg):
|
||||||
|
assert msg.command == 'PRIVMSG'
|
||||||
|
for otherIrc in self.ircs.itervalues():
|
||||||
|
if otherIrc != irc:
|
||||||
|
if msg.args[0] in otherIrc.state.channels:
|
||||||
|
otherIrc.queueMsg(msg)
|
||||||
|
|
||||||
def doPrivmsg(self, irc, msg):
|
def doPrivmsg(self, irc, msg):
|
||||||
callbacks.Privmsg.doPrivmsg(self, irc, msg)
|
callbacks.Privmsg.doPrivmsg(self, irc, msg)
|
||||||
if not isinstance(irc, irclib.Irc):
|
if not isinstance(irc, irclib.Irc):
|
||||||
@ -458,10 +465,8 @@ class Relay(callbacks.Privmsg):
|
|||||||
return
|
return
|
||||||
abbreviation = self.abbreviations[irc]
|
abbreviation = self.abbreviations[irc]
|
||||||
s = self._formatPrivmsg(msg.nick, abbreviation, msg)
|
s = self._formatPrivmsg(msg.nick, abbreviation, msg)
|
||||||
for otherIrc in self.ircs.itervalues():
|
m = ircmsgs.privmsg(channel, s)
|
||||||
if otherIrc != irc:
|
self._sendToOthers(irc, m)
|
||||||
if channel in otherIrc.state.channels:
|
|
||||||
otherIrc.queueMsg(ircmsgs.privmsg(channel, s))
|
|
||||||
|
|
||||||
def doJoin(self, irc, msg):
|
def doJoin(self, irc, msg):
|
||||||
if self.started:
|
if self.started:
|
||||||
@ -472,10 +477,8 @@ class Relay(callbacks.Privmsg):
|
|||||||
return
|
return
|
||||||
abbreviation = self.abbreviations[irc]
|
abbreviation = self.abbreviations[irc]
|
||||||
s = '%s (%s) has joined on %s' % (msg.nick,msg.prefix,abbreviation)
|
s = '%s (%s) has joined on %s' % (msg.nick,msg.prefix,abbreviation)
|
||||||
for otherIrc in self.ircs.itervalues():
|
m = ircmsgs.privmsg(channel, s)
|
||||||
if otherIrc != irc:
|
self._sendToOthers(irc, m)
|
||||||
if channel in otherIrc.state.channels:
|
|
||||||
otherIrc.queueMsg(ircmsgs.privmsg(channel, s))
|
|
||||||
|
|
||||||
def doPart(self, irc, msg):
|
def doPart(self, irc, msg):
|
||||||
if self.started:
|
if self.started:
|
||||||
@ -486,30 +489,29 @@ class Relay(callbacks.Privmsg):
|
|||||||
return
|
return
|
||||||
abbreviation = self.abbreviations[irc]
|
abbreviation = self.abbreviations[irc]
|
||||||
s = '%s (%s) has left on %s' % (msg.nick, msg.prefix, abbreviation)
|
s = '%s (%s) has left on %s' % (msg.nick, msg.prefix, abbreviation)
|
||||||
for otherIrc in self.ircs.itervalues():
|
m = ircmsgs.privmsg(channel, s)
|
||||||
if otherIrc != irc:
|
self._sendToOthers(irc, m)
|
||||||
if channel in otherIrc.state.channels:
|
|
||||||
otherIrc.queueMsg(ircmsgs.privmsg(channel, s))
|
|
||||||
|
|
||||||
def doMode(self, irc, msg):
|
def doMode(self, irc, msg):
|
||||||
if self.started:
|
if self.started:
|
||||||
if not isinstance(irc, irclib.Irc):
|
if not isinstance(irc, irclib.Irc):
|
||||||
irc = irc.getRealIrc()
|
irc = irc.getRealIrc()
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
if channel in self.channels:
|
if channel not in self.channels:
|
||||||
|
return
|
||||||
abbreviation = self.abbreviations[irc]
|
abbreviation = self.abbreviations[irc]
|
||||||
s = 'mode change by %s on %s: %s' % \
|
s = 'mode change by %s on %s: %s' % \
|
||||||
(msg.nick, abbreviation, ' '.join(msg.args[1:]))
|
(msg.nick, abbreviation, ' '.join(msg.args[1:]))
|
||||||
for otherIrc in self.ircs.itervalues():
|
m = ircmsgs.privmsg(channel, s)
|
||||||
if otherIrc != irc:
|
self._sendToOthers(irc, m)
|
||||||
otherIrc.queueMsg(ircmsgs.privmsg(channel, s))
|
|
||||||
|
|
||||||
def doKick(self, irc, msg):
|
def doKick(self, irc, msg):
|
||||||
if self.started:
|
if self.started:
|
||||||
if not isinstance(irc, irclib.Irc):
|
if not isinstance(irc, irclib.Irc):
|
||||||
irc = irc.getRealIrc()
|
irc = irc.getRealIrc()
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
if channel in self.channels:
|
if channel not in self.channels:
|
||||||
|
return
|
||||||
abbrev = self.abbreviations[irc]
|
abbrev = self.abbreviations[irc]
|
||||||
if len(msg.args) == 3:
|
if len(msg.args) == 3:
|
||||||
s = '%s@%s was kicked by %s@%s (%s)' % \
|
s = '%s@%s was kicked by %s@%s (%s)' % \
|
||||||
@ -517,9 +519,8 @@ class Relay(callbacks.Privmsg):
|
|||||||
else:
|
else:
|
||||||
s = '%s@%s was kicked by %s@%s' % \
|
s = '%s@%s was kicked by %s@%s' % \
|
||||||
(msg.args[1], abbrev, msg.nick, abbrev)
|
(msg.args[1], abbrev, msg.nick, abbrev)
|
||||||
for otherIrc in self.ircs.itervalues():
|
m = ircmsgs.privmsg(channel, s)
|
||||||
if otherIrc != irc:
|
self._sendToOthers(irc, m)
|
||||||
otherIrc.queueMsg(ircmsgs.privmsg(channel, s))
|
|
||||||
|
|
||||||
def doNick(self, irc, msg):
|
def doNick(self, irc, msg):
|
||||||
if self.started:
|
if self.started:
|
||||||
@ -530,9 +531,18 @@ class Relay(callbacks.Privmsg):
|
|||||||
s = 'nick change by %s to %s on %s' % (msg.nick, newNick, network)
|
s = 'nick change by %s to %s on %s' % (msg.nick, newNick, network)
|
||||||
for channel in self.channels:
|
for channel in self.channels:
|
||||||
if newNick in irc.state.channels[channel].users:
|
if newNick in irc.state.channels[channel].users:
|
||||||
for otherIrc in self.ircs.itervalues():
|
m = ircmsgs.privmsg(channel, s)
|
||||||
if otherIrc != irc:
|
self._sendToOthers(irc, m)
|
||||||
otherIrc.queueMsg(ircmsgs.privmsg(channel, s))
|
|
||||||
|
def doTopic(self, irc, msg):
|
||||||
|
if self.started:
|
||||||
|
if not isinstance(irc, irclib.Irc):
|
||||||
|
irc = irc.getRealIrc()
|
||||||
|
newTopic = msg.args[1]
|
||||||
|
network = self.abbreviations[irc]
|
||||||
|
s = 'topic change by %s on %s: %s' % (msg.nick, network, newTopic)
|
||||||
|
m = ircmsgs.privmsg(msg.args[0], s)
|
||||||
|
self._sendToOthers(irc, m)
|
||||||
|
|
||||||
def doQuit(self, irc, msg):
|
def doQuit(self, irc, msg):
|
||||||
if self.started:
|
if self.started:
|
||||||
@ -545,9 +555,8 @@ class Relay(callbacks.Privmsg):
|
|||||||
s = '%s has quit %s.' % (msg.nick, network)
|
s = '%s has quit %s.' % (msg.nick, network)
|
||||||
for channel in self.channels:
|
for channel in self.channels:
|
||||||
if msg.nick in self.ircstates[irc].channels[channel].users:
|
if msg.nick in self.ircstates[irc].channels[channel].users:
|
||||||
for otherIrc in self.ircs.itervalues():
|
m = ircmsgs.privmsg(channel, s)
|
||||||
if otherIrc != irc:
|
self._sendToOthers(irc, m)
|
||||||
otherIrc.queueMsg(ircmsgs.privmsg(channel, s))
|
|
||||||
|
|
||||||
def outFilter(self, irc, msg):
|
def outFilter(self, irc, msg):
|
||||||
if not self.started:
|
if not self.started:
|
||||||
@ -565,7 +574,8 @@ class Relay(callbacks.Privmsg):
|
|||||||
'has joined on ' in text or \
|
'has joined on ' in text or \
|
||||||
'has quit' in text or \
|
'has quit' in text or \
|
||||||
text.startswith('mode change') or \
|
text.startswith('mode change') or \
|
||||||
text.startswith('nick change')):
|
text.startswith('nick change') or \
|
||||||
|
text.startswith('topic change')):
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
if channel in self.channels:
|
if channel in self.channels:
|
||||||
abbreviation = self.abbreviations[irc]
|
abbreviation = self.abbreviations[irc]
|
||||||
|
Loading…
Reference in New Issue
Block a user