diff sat/plugins/plugin_xep_0045.py @ 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 35a0ab3032bb
children 003b8b4b56a7
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 ##