Manually count ACK/NAK for REQed CAPs before ENDing CAP negotiation

This commit is contained in:
jesopo 2019-02-05 19:20:02 +00:00
parent ff2d5ef7e7
commit 5991e02b0a
2 changed files with 11 additions and 10 deletions

View file

@ -314,17 +314,16 @@ class Module(ModuleManager.BaseModule):
capabilities=capabilities) capabilities=capabilities)
elif subcommand == "ack": elif subcommand == "ack":
event["server"].capabilities.update(capabilities) event["server"].capabilities.update(capabilities)
if not is_multiline: self._event(event, "cap.ack", capabilities=capabilities,
self._event(event, "cap.ack", server=event["server"])
capabilities=event["server"].capabilities,
server=event["server"])
if event["server"].cap_started and not event["server" if subcommand == "ack" or subcommand == "nak":
].waiting_for_capabilities(): for capability in capabilities:
event["server"].cap_started = False event["server"].requested_capabilities.remove(capability)
event["server"].send_capability_end() if (event["server"].cap_started and
elif subcommand == "nack": not event["server"].waiting_for_capabilities()):
event["server"].send_capability_end() event["server"].cap_started = False
event["server"].send_capability_end()
# the server is asking for authentication # the server is asking for authentication
@utils.hook("raw.received.authenticate") @utils.hook("raw.received.authenticate")

View file

@ -30,6 +30,7 @@ class Server(IRCObject.Object):
self._capability_queue = set([]) # type: typing.Set[str] self._capability_queue = set([]) # type: typing.Set[str]
self._capabilities_waiting = set([]) # type: typing.Set[str] self._capabilities_waiting = set([]) # type: typing.Set[str]
self.capabilities = set([]) # type: typing.Set[str] self.capabilities = set([]) # type: typing.Set[str]
self.requested_capabilities = [] # type: typing.List[str]
self.server_capabilities = {} # type: typing.Dict[str, str] self.server_capabilities = {} # type: typing.Dict[str, str]
self.batches = {} # type: typing.Dict[str, utils.irc.IRCLine] self.batches = {} # type: typing.Dict[str, utils.irc.IRCLine]
self.cap_started = False self.cap_started = False
@ -363,6 +364,7 @@ class Server(IRCObject.Object):
def send_capability_queue(self): def send_capability_queue(self):
if self.has_capability_queue(): if self.has_capability_queue():
capabilities = " ".join(self._capability_queue) capabilities = " ".join(self._capability_queue)
self.requested_capabilities = list(self._capability_queue)
self._capability_queue.clear() self._capability_queue.clear()
self.send_capability_request(capabilities) self.send_capability_request(capabilities)
def has_capability_queue(self): def has_capability_queue(self):