changeset 2728:1b11da85492c

plugin XEP-0045: fixed bad MAM detection on join
author Goffi <goffi@goffi.org>
date Wed, 26 Dec 2018 17:21:39 +0100
parents 59ac9284dee8
children edd230651138
files sat/plugins/plugin_xep_0045.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0045.py	Wed Dec 26 17:21:38 2018 +0100
+++ b/sat/plugins/plugin_xep_0045.py	Wed Dec 26 17:21:39 2018 +0100
@@ -935,12 +935,15 @@
 
         defer.returnValue(room)
 
+    @defer.inlineCallbacks
     def join(self, room_jid, nick, password=None):
-        if (not self._mam or not self.host.hasFeature(self.client,
-                                                      mam.NS_MAM, room_jid)):
-            return self._joinLegacy(self.client, room_jid, nick, password)
+        has_mam = yield self.host.hasFeature(self.client, mam.NS_MAM, room_jid)
+        if not self._mam or not has_mam:
+            room = yield self._joinLegacy(self.client, room_jid, nick, password)
+            defer.returnValue(room)
         else:
-            return self._joinMAM(self.client, room_jid, nick, password)
+            room = yield self._joinMAM(self.client, room_jid, nick, password)
+            defer.returnValue(room)
 
     ## presence/roster ##