changeset 2796:fdc53c8a5439

plugin XEP-0198: don't use hooks on components
author Goffi <goffi@goffi.org>
date Sat, 02 Feb 2019 01:05:25 +0100
parents 25639611c303
children 7968c8b7b5e1
files sat/plugins/plugin_xep_0198.py
diffstat 1 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0198.py	Sat Jan 26 20:08:33 2019 +0100
+++ b/sat/plugins/plugin_xep_0198.py	Sat Feb 02 01:05:25 2019 +0100
@@ -202,6 +202,8 @@
         return True
 
     def _disconnectedTrigger(self, client, reason):
+        if client.is_component:
+            return True
         session = client._xep_0198_session
         session.enabled = False
         if session.resume_enabled:
@@ -406,18 +408,20 @@
             d.addCallback(lambda __: client.presence.available())
 
     def onReceive(self, element, client):
-        session = client._xep_0198_session
-        if session.enabled and element.name.lower() in C.STANZA_NAMES:
-            session.in_counter += 1 % MAX_COUNTER
+        if not client.is_component:
+            session = client._xep_0198_session
+            if session.enabled and element.name.lower() in C.STANZA_NAMES:
+                session.in_counter += 1 % MAX_COUNTER
 
     def onSend(self, obj, client):
-        session = client._xep_0198_session
-        if (session.enabled
-            and domish.IElement.providedBy(obj)
-            and obj.name.lower() in C.STANZA_NAMES):
-            session.out_counter += 1 % MAX_COUNTER
-            session.buffer.appendleft(obj)
-            self.checkAcks(client)
+        if not client.is_component:
+            session = client._xep_0198_session
+            if (session.enabled
+                and domish.IElement.providedBy(obj)
+                and obj.name.lower() in C.STANZA_NAMES):
+                session.out_counter += 1 % MAX_COUNTER
+                session.buffer.appendleft(obj)
+                self.checkAcks(client)
 
     def onAckRequest(self, r_elt, client):
         self.sendAck(client)