mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-17 14:10:41 +01:00
Quit messages actually go through now.
This commit is contained in:
parent
6d1d6013cd
commit
64b7d0d735
13
src/Owner.py
13
src/Owner.py
@ -449,12 +449,19 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
irc.queueMsg(m)
|
irc.queueMsg(m)
|
||||||
|
|
||||||
def quit(self, irc, msg, args):
|
def quit(self, irc, msg, args):
|
||||||
"""takes no arguments
|
"""[<text>]
|
||||||
|
|
||||||
Exits the bot.
|
Exits the bot with the QUIT message <text>. If <text> is not given,
|
||||||
|
your nick will be substituted.
|
||||||
"""
|
"""
|
||||||
|
text = privmsgs.getArgs(args, required=0, optional=1)
|
||||||
|
if not text:
|
||||||
|
text = msg.nick
|
||||||
|
m = ircmsgs.quit(text)
|
||||||
world.upkeep()
|
world.upkeep()
|
||||||
world.ircs[:] = []
|
for irc in world.ircs:
|
||||||
|
irc.queueMsg(m)
|
||||||
|
irc.die()
|
||||||
|
|
||||||
def flush(self, irc, msg, args):
|
def flush(self, irc, msg, args):
|
||||||
"""takes no arguments
|
"""takes no arguments
|
||||||
|
@ -402,6 +402,8 @@ class IrcState(IrcCommandDispatcher):
|
|||||||
def doQuit(self, irc, msg):
|
def doQuit(self, irc, msg):
|
||||||
for channel in self.channels.itervalues():
|
for channel in self.channels.itervalues():
|
||||||
channel.removeUser(msg.nick)
|
channel.removeUser(msg.nick)
|
||||||
|
if msg.nick in self.nicksToHostmasks:
|
||||||
|
# If we're quitting, it may not be.
|
||||||
del self.nicksToHostmasks[msg.nick]
|
del self.nicksToHostmasks[msg.nick]
|
||||||
|
|
||||||
def doTopic(self, irc, msg):
|
def doTopic(self, irc, msg):
|
||||||
@ -449,6 +451,7 @@ class Irc(IrcCommandDispatcher):
|
|||||||
'254', '255', '265', '266', '372', '375', '376',
|
'254', '255', '265', '266', '372', '375', '376',
|
||||||
'333', '353', '332', '366', '005'])
|
'333', '353', '332', '366', '005'])
|
||||||
def __init__(self, network, callbacks=None):
|
def __init__(self, network, callbacks=None):
|
||||||
|
self.zombie = False
|
||||||
world.ircs.append(self)
|
world.ircs.append(self)
|
||||||
self.network = network
|
self.network = network
|
||||||
if callbacks is None:
|
if callbacks is None:
|
||||||
@ -542,11 +545,17 @@ class Irc(IrcCommandDispatcher):
|
|||||||
|
|
||||||
def queueMsg(self, msg):
|
def queueMsg(self, msg):
|
||||||
"""Queues a message to be sent to the server."""
|
"""Queues a message to be sent to the server."""
|
||||||
|
if not self.zombie:
|
||||||
self.queue.enqueue(msg)
|
self.queue.enqueue(msg)
|
||||||
|
else:
|
||||||
|
self.log.warning('Refusing to queue %r; I\'m a zombie.', msg)
|
||||||
|
|
||||||
def sendMsg(self, msg):
|
def sendMsg(self, msg):
|
||||||
"""Queues a message to be sent to the server *immediately*"""
|
"""Queues a message to be sent to the server *immediately*"""
|
||||||
|
if not self.zombie:
|
||||||
self.fastqueue.enqueue(msg)
|
self.fastqueue.enqueue(msg)
|
||||||
|
else:
|
||||||
|
self.log.warning('Refusing to send %r; I\'m a zombie.', msg)
|
||||||
|
|
||||||
def takeMsg(self):
|
def takeMsg(self):
|
||||||
"""Called by the IrcDriver; takes a message to be sent."""
|
"""Called by the IrcDriver; takes a message to be sent."""
|
||||||
@ -589,6 +598,9 @@ class Irc(IrcCommandDispatcher):
|
|||||||
self.state.addMsg(self, msg)
|
self.state.addMsg(self, msg)
|
||||||
log.debug('Outgoing message: ' + str(msg).rstrip('\r\n'))
|
log.debug('Outgoing message: ' + str(msg).rstrip('\r\n'))
|
||||||
return msg
|
return msg
|
||||||
|
else:
|
||||||
|
if self.zombie:
|
||||||
|
self._reallyDie()
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -714,6 +726,9 @@ class Irc(IrcCommandDispatcher):
|
|||||||
world.debugFlush()
|
world.debugFlush()
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
|
self.zombie = True
|
||||||
|
|
||||||
|
def _reallyDie(self):
|
||||||
"""Makes the Irc object die. Dead."""
|
"""Makes the Irc object die. Dead."""
|
||||||
log.info('Irc object for %s dying.' % self.server)
|
log.info('Irc object for %s dying.' % self.server)
|
||||||
if self in world.ircs:
|
if self in world.ircs:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user