Send CAP END when we're not waiting for any capability handshakes

This commit is contained in:
jesopo 2018-09-03 11:18:20 +01:00
parent 29851d4305
commit 0f578b1ec1
2 changed files with 5 additions and 0 deletions

View file

@ -267,6 +267,9 @@ class LineHandler(object):
event["server"].send_capability_queue() event["server"].send_capability_queue()
else: else:
event["server"].send_capability_end() event["server"].send_capability_end()
elif subcommand == "ack" or subcommand == "nack":
if not event["server"].waiting_for_capabilities():
event["server"].send_capability_end()
# the server is asking for authentication # the server is asking for authentication
def authenticate(self, event): def authenticate(self, event):

View file

@ -293,6 +293,8 @@ class Server(object):
def send_authenticate(self, text): def send_authenticate(self, text):
self.send("AUTHENTICATE %s" % text) self.send("AUTHENTICATE %s" % text)
def waiting_for_capabilities(self):
return bool(len(self._capabilities_waiting))
def wait_for_capability(self, capability): def wait_for_capability(self, capability):
self._capabilities_waiting.add(capability) self._capabilities_waiting.add(capability)
def capability_done(self, capability): def capability_done(self, capability):