summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-03-16 23:16:17 -0700
committerLance Stout <lancestout@gmail.com>2012-03-16 23:16:17 -0700
commiteb25998e72d728b16d75f5d70cf930da16ec7cf0 (patch)
treec920b6cfd31c9b906d5b158a3a42e04c3720d05d /sleekxmpp/plugins
parenteafd2aee93c56da98f7385f6589a0dcdb6aaa1c4 (diff)
downloadslixmpp-eb25998e72d728b16d75f5d70cf930da16ec7cf0.tar.gz
slixmpp-eb25998e72d728b16d75f5d70cf930da16ec7cf0.tar.bz2
slixmpp-eb25998e72d728b16d75f5d70cf930da16ec7cf0.tar.xz
slixmpp-eb25998e72d728b16d75f5d70cf930da16ec7cf0.zip
Update subscription event expiry value to use time objects.
Diffstat (limited to 'sleekxmpp/plugins')
-rw-r--r--sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py b/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py
index 2b69af0f..4b2012b4 100644
--- a/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py
+++ b/sleekxmpp/plugins/xep_0060/stanza/pubsub_event.py
@@ -6,9 +6,12 @@
See the file LICENSE for copying permission.
"""
+import datetime as dt
+
from sleekxmpp import Message
from sleekxmpp.xmlstream import register_stanza_plugin, ElementBase, ET, JID
from sleekxmpp.plugins.xep_0004 import Form
+from sleekxmpp.plugins import xep_0082
class Event(ElementBase):
@@ -116,6 +119,15 @@ class EventSubscription(ElementBase):
plugin_attrib = name
interfaces = set(('node', 'expiry', 'jid', 'subid', 'subscription'))
+ def get_expiry(self):
+ expiry = self._get_attr('expiry')
+ return xep_0082.parse(expiry)
+
+ def set_expiry(self, value):
+ if isinstance(value, dt.datetime):
+ value = xep_0082.format_datetime(value)
+ self._set_attr('expiry', value)
+
def set_jid(self, value):
self._set_attr('jid', str(value))