mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +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:
|
else:
|
||||||
port = 6667
|
port = 6667
|
||||||
newIrc = irclib.Irc(irc.nick, callbacks=irc.callbacks)
|
newIrc = irclib.Irc(irc.nick, callbacks=irc.callbacks)
|
||||||
driver = asyncoreDrivers.AsyncoreDriver((server, port))
|
driver = asyncoreDrivers.AsyncoreDriver((server, port), newIrc)
|
||||||
driver.irc = newIrc
|
|
||||||
newIrc.driver = driver
|
newIrc.driver = driver
|
||||||
self.ircs[abbreviation] = newIrc
|
self.ircs[abbreviation] = newIrc
|
||||||
self.abbreviations[newIrc] = abbreviation
|
self.abbreviations[newIrc] = abbreviation
|
||||||
|
@ -58,12 +58,12 @@ class AsyncoreRunnerDriver(drivers.IrcDriver):
|
|||||||
|
|
||||||
|
|
||||||
class AsyncoreDriver(asynchat.async_chat, object):
|
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__')
|
#debug.methodNamePrintf(self, '__init__')
|
||||||
asynchat.async_chat.__init__(self)
|
asynchat.async_chat.__init__(self)
|
||||||
self.server = (server, port)
|
self.server = (server, port)
|
||||||
self.reconnect = reconnect
|
self.reconnect = reconnect
|
||||||
self.irc = None # Satisfy PyChecker.
|
self.irc = irc
|
||||||
self.buffer = ''
|
self.buffer = ''
|
||||||
self.set_terminator('\n')
|
self.set_terminator('\n')
|
||||||
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
|
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')
|
debug.msg('Scheduling reconnect at %s' % whenS, 'normal')
|
||||||
def makeNewDriver():
|
def makeNewDriver():
|
||||||
self.irc.reset()
|
self.irc.reset()
|
||||||
driver = self.__class__(self.server, reconnect=self.reconnect)
|
driver = self.__class__(self.server, self.irc, self.reconnect)
|
||||||
driver.irc = self.irc
|
|
||||||
driver.irc.driver = driver
|
driver.irc.driver = driver
|
||||||
schedule.addEvent(makeNewDriver, when)
|
schedule.addEvent(makeNewDriver, when)
|
||||||
|
|
||||||
def writable(self):
|
def writable(self):
|
||||||
#debug.methodNamePrintf(self, 'writable')
|
#debug.methodNamePrintf(self, 'writable')
|
||||||
while self.connected:
|
while self.connected and self.irc:
|
||||||
m = self.irc.takeMsg()
|
m = self.irc.takeMsg()
|
||||||
if m:
|
if m:
|
||||||
self.push(str(m))
|
self.push(str(m))
|
||||||
|
@ -140,7 +140,7 @@ def processConfigFile(filename):
|
|||||||
irc.reset()
|
irc.reset()
|
||||||
world.startup = False
|
world.startup = False
|
||||||
irc.addCallback(ConfigAfter376(after376))
|
irc.addCallback(ConfigAfter376(after376))
|
||||||
driver = asyncoreDrivers.AsyncoreDriver(server)
|
driver = asyncoreDrivers.AsyncoreDriver(server, irc)
|
||||||
driver.irc = irc
|
driver.irc = irc
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
reportConfigError(filename, e)
|
reportConfigError(filename, e)
|
||||||
|
Loading…
Reference in New Issue
Block a user