diff options
-rw-r--r-- | slixmpp/plugins/xep_0059/rsm.py | 6 | ||||
-rw-r--r-- | slixmpp/plugins/xep_0313/mam.py | 2 | ||||
-rw-r--r-- | slixmpp/plugins/xep_0313/stanza.py | 18 |
3 files changed, 23 insertions, 3 deletions
diff --git a/slixmpp/plugins/xep_0059/rsm.py b/slixmpp/plugins/xep_0059/rsm.py index 61752af4..085ee474 100644 --- a/slixmpp/plugins/xep_0059/rsm.py +++ b/slixmpp/plugins/xep_0059/rsm.py @@ -135,6 +135,9 @@ class ResultIterator(AsyncIterator): not r[self.recv_interface]['rsm']['last']: raise StopAsyncIteration + if self.post_cb: + self.post_cb(r) + if r[self.recv_interface]['rsm']['count'] and \ r[self.recv_interface]['rsm']['first_index']: count = int(r[self.recv_interface]['rsm']['count']) @@ -147,9 +150,6 @@ class ResultIterator(AsyncIterator): self.start = r[self.recv_interface]['rsm']['first'] else: self.start = r[self.recv_interface]['rsm']['last'] - - if self.post_cb: - self.post_cb(r) return r except XMPPError: raise StopAsyncIteration diff --git a/slixmpp/plugins/xep_0313/mam.py b/slixmpp/plugins/xep_0313/mam.py index c06360c4..cc3b1958 100644 --- a/slixmpp/plugins/xep_0313/mam.py +++ b/slixmpp/plugins/xep_0313/mam.py @@ -112,6 +112,7 @@ class XEP_0313(BasePlugin): results = cb_data['collector'].stop() if result['type'] == 'result': result['mam']['results'] = results + result['mam_fin']['results'] = results if iterator: return self.xmpp['xep_0059'].iterate( @@ -185,6 +186,7 @@ class XEP_0313(BasePlugin): results = cb_data['collector'].stop() if result['type'] == 'result': result['mam']['results'] = results + result['mam_fin']['results'] = results iterator = self.xmpp['xep_0059'].iterate( iq, 'mam', 'results', amount=amount, diff --git a/slixmpp/plugins/xep_0313/stanza.py b/slixmpp/plugins/xep_0313/stanza.py index fbca3c8e..6633717f 100644 --- a/slixmpp/plugins/xep_0313/stanza.py +++ b/slixmpp/plugins/xep_0313/stanza.py @@ -187,6 +187,24 @@ class Fin(ElementBase): name = 'fin' namespace = 'urn:xmpp:mam:2' plugin_attrib = 'mam_fin' + interfaces = {'results'} + + def setup(self, xml=None): + ElementBase.setup(self, xml) + self._results: List[Message] = [] + + # The results interface is meant only as an easy + # way to access the set of collected message responses + # from the query. + + def get_results(self) -> List[Message]: + return self._results + + def set_results(self, values: List[Message]): + self._results = values + + def del_results(self): + self._results = [] class Result(ElementBase): |