From 23b0e58665a7a7128b75f1756faddfdf394ef74d Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 16 Feb 2019 08:21:42 +0000 Subject: [PATCH] Send `CAP REQ` in 10-item chunks (src/IRCServer.py) --- src/IRCServer.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/IRCServer.py b/src/IRCServer.py index acc2519f..0b4eb350 100644 --- a/src/IRCServer.py +++ b/src/IRCServer.py @@ -270,10 +270,13 @@ class Server(IRCObject.Object): self._capability_queue.update(capabilities) def send_capability_queue(self): if self.has_capability_queue(): - capabilities = " ".join(self._capability_queue) - self.requested_capabilities = list(self._capability_queue) + capability_queue = list(self._capability_queue) self._capability_queue.clear() - self.send_capability_request(capabilities) + + for i in range(0, len(capability_queue), 10): + capability_batch = capability_queue[i:i+10] + self.requested_capabilities += capability_batch + self.send_capability_request(" ".join(capability_batch)) def has_capability_queue(self): return bool(len(self._capability_queue)) def send_capability_request(self, capability: str) -> IRCLine.Line: