comparison 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
comparison
equal deleted inserted replaced
2825:1b6547fb80da 2826:177f11163ed0
888 # we don't want any history from room as we'll get it with MAM 888 # we don't want any history from room as we'll get it with MAM
889 room_jid, nick, muc.HistoryOptions(maxStanzas=0), password=password) 889 room_jid, nick, muc.HistoryOptions(maxStanzas=0), password=password)
890 room._history_type = HISTORY_MAM 890 room._history_type = HISTORY_MAM
891 room._history_d = defer.Deferred() 891 room._history_d = defer.Deferred()
892 892
893 last_mess = yield self.host.memory.historyGet(room_jid, 893 last_mess = yield self.host.memory.historyGet(
894 None, 894 room_jid,
895 limit=1, 895 None,
896 between=False, 896 limit=1,
897 filters={u'last_stanza_id': True}, 897 between=False,
898 profile=client.profile) 898 filters={
899 u'types': C.MESS_TYPE_GROUPCHAT,
900 u'last_stanza_id': True},
901 profile=client.profile)
899 if last_mess: 902 if last_mess:
900 stanza_id = last_mess[0][-1][u'stanza_id'] 903 stanza_id = last_mess[0][-1][u'stanza_id']
901 rsm_req = rsm.RSMRequest(max_=100, after=stanza_id) 904 rsm_req = rsm.RSMRequest(max_=100, after=stanza_id)
902 no_loop=False 905 no_loop=False
903 else: 906 else: