diff sat/plugins/plugin_xep_0045.py @ 2826:177f11163ed0

plugin XEP-0045: fixed message type filtering when getting last stanza_id to retrieve history with MAM
author Goffi <goffi@goffi.org>
date Fri, 01 Mar 2019 16:17:00 +0100
parents 5284be4c601b
children 9a3b99acad91
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0045.py	Fri Mar 01 15:35:55 2019 +0100
+++ b/sat/plugins/plugin_xep_0045.py	Fri Mar 01 16:17:00 2019 +0100
@@ -890,12 +890,15 @@
         room._history_type = HISTORY_MAM
         room._history_d = defer.Deferred()
 
-        last_mess = yield self.host.memory.historyGet(room_jid,
-                                                      None,
-                                                      limit=1,
-                                                      between=False,
-                                                      filters={u'last_stanza_id': True},
-                                                      profile=client.profile)
+        last_mess = yield self.host.memory.historyGet(
+            room_jid,
+            None,
+            limit=1,
+            between=False,
+            filters={
+                u'types': C.MESS_TYPE_GROUPCHAT,
+                u'last_stanza_id': True},
+            profile=client.profile)
         if last_mess:
             stanza_id = last_mess[0][-1][u'stanza_id']
             rsm_req = rsm.RSMRequest(max_=100, after=stanza_id)