mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Changed AsyncoreDriver to accept an irc as an argument, hopefully fixing the looping bug.
This commit is contained in:
parent
60169accb2
commit
8c9811ea05
@ -132,8 +132,7 @@ class Relay(callbacks.Privmsg):
|
||||
else:
|
||||
port = 6667
|
||||
newIrc = irclib.Irc(irc.nick, callbacks=irc.callbacks)
|
||||
driver = asyncoreDrivers.AsyncoreDriver((server, port))
|
||||
driver.irc = newIrc
|
||||
driver = asyncoreDrivers.AsyncoreDriver((server, port), newIrc)
|
||||
newIrc.driver = driver
|
||||
self.ircs[abbreviation] = newIrc
|
||||
self.abbreviations[newIrc] = abbreviation
|
||||
|
@ -58,12 +58,12 @@ class AsyncoreRunnerDriver(drivers.IrcDriver):
|
||||
|
||||
|
||||
class AsyncoreDriver(asynchat.async_chat, object):
|
||||
def __init__(self, (server, port), reconnect=True):
|
||||
def __init__(self, (server, port), irc, reconnect=True):
|
||||
#debug.methodNamePrintf(self, '__init__')
|
||||
asynchat.async_chat.__init__(self)
|
||||
self.server = (server, port)
|
||||
self.reconnect = reconnect
|
||||
self.irc = None # Satisfy PyChecker.
|
||||
self.irc = irc
|
||||
self.buffer = ''
|
||||
self.set_terminator('\n')
|
||||
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
@ -81,14 +81,13 @@ class AsyncoreDriver(asynchat.async_chat, object):
|
||||
debug.msg('Scheduling reconnect at %s' % whenS, 'normal')
|
||||
def makeNewDriver():
|
||||
self.irc.reset()
|
||||
driver = self.__class__(self.server, reconnect=self.reconnect)
|
||||
driver.irc = self.irc
|
||||
driver = self.__class__(self.server, self.irc, self.reconnect)
|
||||
driver.irc.driver = driver
|
||||
schedule.addEvent(makeNewDriver, when)
|
||||
|
||||
def writable(self):
|
||||
#debug.methodNamePrintf(self, 'writable')
|
||||
while self.connected:
|
||||
while self.connected and self.irc:
|
||||
m = self.irc.takeMsg()
|
||||
if m:
|
||||
self.push(str(m))
|
||||
|
@ -140,7 +140,7 @@ def processConfigFile(filename):
|
||||
irc.reset()
|
||||
world.startup = False
|
||||
irc.addCallback(ConfigAfter376(after376))
|
||||
driver = asyncoreDrivers.AsyncoreDriver(server)
|
||||
driver = asyncoreDrivers.AsyncoreDriver(server, irc)
|
||||
driver.irc = irc
|
||||
except IOError, e:
|
||||
reportConfigError(filename, e)
|
||||
|
Loading…
Reference in New Issue
Block a user