mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Should be able to reload Relay now, but it's untested.
This commit is contained in:
parent
8e624e6eac
commit
1f4c16367a
@ -93,6 +93,20 @@ def configure(onStart, afterConnect, advanced):
|
|||||||
afterConnect.append('relay color 2')
|
afterConnect.append('relay color 2')
|
||||||
|
|
||||||
|
|
||||||
|
ircs = {}
|
||||||
|
ircstates = {}
|
||||||
|
lastmsg = {}
|
||||||
|
channels = ircutils.IrcSet()
|
||||||
|
abbreviations = {}
|
||||||
|
originalIrc = None
|
||||||
|
|
||||||
|
def reload(x=None):
|
||||||
|
global ircs, ircstates, lastmsg, channels, abbreviations, originalIrc
|
||||||
|
if x is None:
|
||||||
|
return (ircs, ircstates, lastmsg, channels, abbreviations, originalIrc)
|
||||||
|
else:
|
||||||
|
(ircs, ircstates, lastmsg, channels, abbreviations, originalIrc) = x
|
||||||
|
|
||||||
class Relay(callbacks.Privmsg, plugins.Configurable):
|
class Relay(callbacks.Privmsg, plugins.Configurable):
|
||||||
noIgnore = True
|
noIgnore = True
|
||||||
priority = sys.maxint
|
priority = sys.maxint
|
||||||
@ -104,15 +118,14 @@ class Relay(callbacks.Privmsg, plugins.Configurable):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
plugins.Configurable.__init__(self)
|
plugins.Configurable.__init__(self)
|
||||||
self.ircs = {}
|
self.ircs = ircs
|
||||||
self._color = 0
|
self._color = 0
|
||||||
self._whois = {}
|
self._whois = {}
|
||||||
self.started = False
|
self.started = False
|
||||||
self.ircstates = {}
|
self.ircstates = ircstates
|
||||||
self.lastmsg = {}
|
self.lastmsg = lastmsg
|
||||||
self.channels = ircutils.IrcSet()
|
self.channels = channels
|
||||||
self.abbreviations = {}
|
self.abbreviations = {}
|
||||||
self.originalIrc = None
|
|
||||||
|
|
||||||
def __call__(self, irc, msg):
|
def __call__(self, irc, msg):
|
||||||
if self.started:
|
if self.started:
|
||||||
@ -128,7 +141,7 @@ class Relay(callbacks.Privmsg, plugins.Configurable):
|
|||||||
callbacks.Privmsg.die(self)
|
callbacks.Privmsg.die(self)
|
||||||
plugins.Configurable.die(self)
|
plugins.Configurable.die(self)
|
||||||
for irc in self.abbreviations:
|
for irc in self.abbreviations:
|
||||||
if irc != self.originalIrc:
|
if irc != originalIrc:
|
||||||
irc.callbacks[:] = []
|
irc.callbacks[:] = []
|
||||||
irc.die()
|
irc.die()
|
||||||
|
|
||||||
@ -148,11 +161,12 @@ class Relay(callbacks.Privmsg, plugins.Configurable):
|
|||||||
relaying messages from that network to other networks, the users
|
relaying messages from that network to other networks, the users
|
||||||
will show up as 'user@oftc'.
|
will show up as 'user@oftc'.
|
||||||
"""
|
"""
|
||||||
|
global originalIrc
|
||||||
if isinstance(irc, irclib.Irc):
|
if isinstance(irc, irclib.Irc):
|
||||||
realIrc = irc
|
realIrc = irc
|
||||||
else:
|
else:
|
||||||
realIrc = irc.getRealIrc()
|
realIrc = irc.getRealIrc()
|
||||||
self.originalIrc = realIrc
|
originalIrc = realIrc
|
||||||
abbreviation = privmsgs.getArgs(args)
|
abbreviation = privmsgs.getArgs(args)
|
||||||
self.ircs[abbreviation] = realIrc
|
self.ircs[abbreviation] = realIrc
|
||||||
self.abbreviations[realIrc] = abbreviation
|
self.abbreviations[realIrc] = abbreviation
|
||||||
|
Loading…
Reference in New Issue
Block a user