mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
irclib: Fix hang in cap nego when echo-message is available but not labeled-response.
echo-message ended up in self.state.capabilities_req even though it wasn't requested, so the bot was stuck in state: "Waiting for ACK/NAK of capabilities: {'echo-message'}".
This commit is contained in:
parent
c9c05cf8e1
commit
568b84847b
@ -1682,8 +1682,6 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
|
||||
self._requestCaps(common_supported_unrequested_capabilities)
|
||||
|
||||
def _requestCaps(self, caps):
|
||||
self.state.capabilities_req |= caps
|
||||
|
||||
caps = list(sorted(caps))
|
||||
cap_lines = []
|
||||
if 'echo-message' in caps \
|
||||
@ -1701,6 +1699,9 @@ class Irc(IrcCommandDispatcher, log.Firewalled):
|
||||
# This makes sure they are always on the same line (which
|
||||
# happens to be the first):
|
||||
caps = ['echo-message', 'labeled-response'] + caps
|
||||
|
||||
self.state.capabilities_req |= set(caps)
|
||||
|
||||
caps = ' '.join(caps)
|
||||
# textwrap works here because in ASCII, all chars are 1 bytes:
|
||||
cap_lines = textwrap.wrap(
|
||||
|
@ -522,6 +522,13 @@ class IrcCapsTestCase(SupyTestCase):
|
||||
m = self.irc.takeMsg()
|
||||
self.assertIsNone(m)
|
||||
|
||||
self.irc.feedMsg(ircmsgs.IrcMsg(command='CAP',
|
||||
args=('*', 'ACK', 'account-notify')))
|
||||
|
||||
m = self.irc.takeMsg()
|
||||
self.assertTrue(m.command == 'CAP', 'Expected CAP, got %r.' % m)
|
||||
self.assertEqual(m.args, ('END',), m)
|
||||
|
||||
def testEchomessageLabeledresponseGrouped(self):
|
||||
self.irc = irclib.Irc('test')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user