mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +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,40 +489,38 @@ 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:
|
||||||
abbreviation = self.abbreviations[irc]
|
return
|
||||||
s = 'mode change by %s on %s: %s' % \
|
abbreviation = self.abbreviations[irc]
|
||||||
(msg.nick, abbreviation, ' '.join(msg.args[1:]))
|
s = 'mode change by %s on %s: %s' % \
|
||||||
for otherIrc in self.ircs.itervalues():
|
(msg.nick, abbreviation, ' '.join(msg.args[1:]))
|
||||||
if otherIrc != irc:
|
m = ircmsgs.privmsg(channel, s)
|
||||||
otherIrc.queueMsg(ircmsgs.privmsg(channel, s))
|
self._sendToOthers(irc, m)
|
||||||
|
|
||||||
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:
|
||||||
abbrev = self.abbreviations[irc]
|
return
|
||||||
if len(msg.args) == 3:
|
abbrev = self.abbreviations[irc]
|
||||||
s = '%s@%s was kicked by %s@%s (%s)' % \
|
if len(msg.args) == 3:
|
||||||
(msg.args[1], abbrev, msg.nick, abbrev, msg.args[2])
|
s = '%s@%s was kicked by %s@%s (%s)' % \
|
||||||
else:
|
(msg.args[1], abbrev, msg.nick, abbrev, msg.args[2])
|
||||||
s = '%s@%s was kicked by %s@%s' % \
|
else:
|
||||||
(msg.args[1], abbrev, msg.nick, abbrev)
|
s = '%s@%s was kicked by %s@%s' % \
|
||||||
for otherIrc in self.ircs.itervalues():
|
(msg.args[1], abbrev, msg.nick, abbrev)
|
||||||
if otherIrc != irc:
|
m = ircmsgs.privmsg(channel, s)
|
||||||
otherIrc.queueMsg(ircmsgs.privmsg(channel, s))
|
self._sendToOthers(irc, m)
|
||||||
|
|
||||||
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