From 10c5f7f0414f283f807a874fc1513c557f091df5 Mon Sep 17 00:00:00 2001 From: lovetox Date: Sat, 1 Aug 2020 08:10:51 +0200 Subject: Add method to disable stream management --- nbxmpp/client.py | 9 +++++++++ nbxmpp/smacks.py | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/nbxmpp/client.py b/nbxmpp/client.py index 06a9696..23b890d 100644 --- a/nbxmpp/client.py +++ b/nbxmpp/client.py @@ -95,6 +95,8 @@ class Client(Observable): self._allowed_protocols = None self._allowed_mechs = None + self._sm_disabled = False + self._stream_id = None self._stream_secure = False self._stream_authenticated = False @@ -273,6 +275,13 @@ class Client(Observable): def set_protocols(self, protocols): self._allowed_protocols = protocols + def set_sm_disabled(self, value): + self._sm_disabled = value + + @property + def sm_disabled(self): + return self._sm_disabled + @property def client_cert(self): return self._client_cert, self._client_cert_pass diff --git a/nbxmpp/smacks.py b/nbxmpp/smacks.py index eafa03a..376ed8a 100644 --- a/nbxmpp/smacks.py +++ b/nbxmpp/smacks.py @@ -103,6 +103,10 @@ class Smacks: def send_enable(self): if not self.sm_supported: return + + if self._client.sm_disabled: + return + enable = Node(Namespace.STREAM_MGMT + ' enable', attrs={'resume': 'true'}) self._client.send_nonza(enable, now=False) self._log.debug('Send enable') -- cgit v1.2.3