summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0313
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/plugins/xep_0313')
-rw-r--r--sleekxmpp/plugins/xep_0313/mam.py2
-rw-r--r--sleekxmpp/plugins/xep_0313/stanza.py22
2 files changed, 17 insertions, 7 deletions
diff --git a/sleekxmpp/plugins/xep_0313/mam.py b/sleekxmpp/plugins/xep_0313/mam.py
index 15aee828..4b82ca03 100644
--- a/sleekxmpp/plugins/xep_0313/mam.py
+++ b/sleekxmpp/plugins/xep_0313/mam.py
@@ -36,6 +36,8 @@ class XEP_0313(BasePlugin):
register_stanza_plugin(Iq, stanza.MAM)
register_stanza_plugin(Iq, stanza.Preferences)
register_stanza_plugin(Message, stanza.Result)
+ register_stanza_plugin(Message, stanza.Archived, iterable=True)
+ register_stanza_plugin(stanza.Result, self.xmpp['xep_0297'].stanza.Forwarded)
register_stanza_plugin(stanza.MAM, self.xmpp['xep_0059'].stanza.Set)
def retrieve(self, jid=None, start=None, end=None, with_jid=None, ifrom=None,
diff --git a/sleekxmpp/plugins/xep_0313/stanza.py b/sleekxmpp/plugins/xep_0313/stanza.py
index a33c2e35..81576cd4 100644
--- a/sleekxmpp/plugins/xep_0313/stanza.py
+++ b/sleekxmpp/plugins/xep_0313/stanza.py
@@ -25,13 +25,13 @@ class MAM(ElementBase):
self._results = []
def get_start(self):
- timestamp = self._get_attr('start')
+ timestamp = self._get_sub_text('start')
return xep_0082.parse(timestamp)
def set_start(self, value):
if isinstance(value, dt.datetime):
value = xep_0082.format_datetime(value)
- self._set_attr('start', value)
+ self._set_sub_text('start', value)
def get_end(self):
timestamp = self._get_sub_text('end')
@@ -122,10 +122,18 @@ class Result(ElementBase):
name = 'result'
namespace = 'urn:xmpp:mam:tmp'
plugin_attrib = 'mam_result'
- interfaces = set(['forwarded', 'queryid', 'id'])
+ interfaces = set(['queryid', 'id'])
- def get_forwarded(self):
- return self.parent()['forwarded']
- def del_forwarded(self):
- del self.parent()['forwarded']
+class Archived(ElementBase):
+ name = 'archived'
+ namespace = 'urn:xmpp:mam:tmp'
+ plugin_attrib = 'mam_archived'
+ plugin_multi_attrib = 'mam_archives'
+ interfaces = set(['by', 'id'])
+
+ def get_by(self):
+ return JID(self._get_attr('by'))
+
+ def set_by(self):
+ return self._set_attr('by', str(value))