mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Fixed multiple servers.
This commit is contained in:
parent
a8a5d5129e
commit
e051e5e192
@ -63,17 +63,19 @@ class AsyncoreRunnerDriver(drivers.IrcDriver):
|
|||||||
|
|
||||||
|
|
||||||
class AsyncoreDriver(asynchat.async_chat, object):
|
class AsyncoreDriver(asynchat.async_chat, object):
|
||||||
def __init__(self, irc):
|
def __init__(self, irc, servers=()):
|
||||||
asynchat.async_chat.__init__(self)
|
asynchat.async_chat.__init__(self)
|
||||||
self.irc = irc
|
self.irc = irc
|
||||||
self.buffer = ''
|
self.buffer = ''
|
||||||
self.servers = ()
|
self.servers = servers
|
||||||
self.networkGroup = conf.supybot.networks.get(self.irc.network)
|
self.networkGroup = conf.supybot.networks.get(self.irc.network)
|
||||||
self.set_terminator('\n')
|
self.set_terminator('\n')
|
||||||
# XXX: Use utils.getSocket.
|
# XXX: Use utils.getSocket.
|
||||||
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
try:
|
try:
|
||||||
self.connect(self._getNextServer())
|
server = self._getNextServer()
|
||||||
|
log.info('Connecting to %s.', self.currentServer)
|
||||||
|
self.connect(server)
|
||||||
except socket.error, e:
|
except socket.error, e:
|
||||||
log.warning('Error connecting to %s: %s', self.currentServer, e)
|
log.warning('Error connecting to %s: %s', self.currentServer, e)
|
||||||
self.reconnect(wait=True)
|
self.reconnect(wait=True)
|
||||||
@ -101,7 +103,7 @@ class AsyncoreDriver(asynchat.async_chat, object):
|
|||||||
self.currentServer, whenS)
|
self.currentServer, whenS)
|
||||||
def makeNewDriver():
|
def makeNewDriver():
|
||||||
self.irc.reset()
|
self.irc.reset()
|
||||||
driver = self.__class__(self.irc)
|
driver = self.__class__(self.irc, servers=self.servers)
|
||||||
schedule.addEvent(makeNewDriver, when)
|
schedule.addEvent(makeNewDriver, when)
|
||||||
|
|
||||||
def writable(self):
|
def writable(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user