Bump to 1.3.1
[slixmpp.git] / sleekxmpp / plugins / xep_0319 / stanza.py
blobabfb4f415be910bf58928cbe0f4c7f01e05a997d
1 """
2 SleekXMPP: The Sleek XMPP Library
3 Copyright (C) 2013 Nathanael C. Fritz, Lance J.T. Stout
4 This file is part of SleekXMPP.
6 See the file LICENSE for copying permission.
7 """
9 import datetime as dt
11 from sleekxmpp.xmlstream import ElementBase
12 from sleekxmpp.plugins import xep_0082
15 class Idle(ElementBase):
16 name = 'idle'
17 namespace = 'urn:xmpp:idle:1'
18 plugin_attrib = 'idle'
19 interfaces = set(['since'])
21 def get_since(self):
22 timestamp = self._get_attr('since')
23 return xep_0082.parse(timestamp)
25 def set_since(self, value):
26 if isinstance(value, dt.datetime):
27 value = xep_0082.format_datetime(value)
28 self._set_attr('since', value)