summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0013/stanza.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-09-26 01:47:05 -0700
committerLance Stout <lancestout@gmail.com>2012-09-26 01:47:05 -0700
commitb5b1c932c7efd2cdf5b4731bde6c8145873da25f (patch)
tree1d97e8bce8071a200e305d8e0c91e71e709fcd99 /sleekxmpp/plugins/xep_0013/stanza.py
parentb8f04983e1fe3ca45471125f005f41cc290d1bbf (diff)
downloadslixmpp-b5b1c932c7efd2cdf5b4731bde6c8145873da25f.tar.gz
slixmpp-b5b1c932c7efd2cdf5b4731bde6c8145873da25f.tar.bz2
slixmpp-b5b1c932c7efd2cdf5b4731bde6c8145873da25f.tar.xz
slixmpp-b5b1c932c7efd2cdf5b4731bde6c8145873da25f.zip
Add support for XEP-0013: Flexible Offline Message Retrieval
Diffstat (limited to 'sleekxmpp/plugins/xep_0013/stanza.py')
-rw-r--r--sleekxmpp/plugins/xep_0013/stanza.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0013/stanza.py b/sleekxmpp/plugins/xep_0013/stanza.py
new file mode 100644
index 00000000..c9c69786
--- /dev/null
+++ b/sleekxmpp/plugins/xep_0013/stanza.py
@@ -0,0 +1,53 @@
+"""
+ SleekXMPP: The Sleek XMPP Library
+ Copyright (C) 2012 Nathanael C. Fritz, Lance J.T. Stout
+ This file is part of SleekXMPP.
+
+ See the file LICENSE for copying permissio
+"""
+
+from sleekxmpp.jid import JID
+from sleekxmpp.xmlstream import ElementBase, register_stanza_plugin
+
+
+class Offline(ElementBase):
+ name = 'offline'
+ namespace = 'http://jabber.org/protocol/offline'
+ plugin_attrib = 'offline'
+ interfaces = set(['fetch', 'purge', 'results'])
+ bool_interfaces = interfaces
+
+ def setup(self, xml=None):
+ ElementBase.setup(self, xml)
+ self._results = []
+
+ # 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):
+ return self._results
+
+ def set_results(self, values):
+ self._results = values
+
+ def del_results(self):
+ self._results = []
+
+
+class Item(ElementBase):
+ name = 'item'
+ namespace = 'http://jabber.org/protocol/offline'
+ plugin_attrib = 'item'
+ interfaces = set(['action', 'node', 'jid'])
+
+ actions = set(['view', 'remove'])
+
+ def get_jid(self):
+ return JID(self._get_attr('jid'))
+
+ def set_jid(self, value):
+ self._set_attr('jid', str(value))
+
+
+register_stanza_plugin(Offline, Item, iterable=True)