From 5ab77c745270d7d5c016c1dc7ef2a82533a4b16e Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Thu, 17 Jul 2014 14:19:04 +0200 Subject: Rename to slixmpp --- slixmpp/plugins/xep_0231/stanza.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 slixmpp/plugins/xep_0231/stanza.py (limited to 'slixmpp/plugins/xep_0231/stanza.py') diff --git a/slixmpp/plugins/xep_0231/stanza.py b/slixmpp/plugins/xep_0231/stanza.py new file mode 100644 index 00000000..f7e6a66c --- /dev/null +++ b/slixmpp/plugins/xep_0231/stanza.py @@ -0,0 +1,36 @@ +""" + Slixmpp: The Slick XMPP Library + Copyright (C) 2012 Nathanael C. Fritz, + Emmanuel Gil Peyrot + This file is part of Slixmpp. + + See the file LICENSE for copying permission. +""" + +import base64 + + +from slixmpp.util import bytes +from slixmpp.xmlstream import ElementBase + + +class BitsOfBinary(ElementBase): + name = 'data' + namespace = 'urn:xmpp:bob' + plugin_attrib = 'bob' + interfaces = set(('cid', 'max_age', 'type', 'data')) + + def get_max_age(self): + return self._get_attr('max-age') + + def set_max_age(self, value): + self._set_attr('max-age', value) + + def get_data(self): + return base64.b64decode(bytes(self.xml.text)) + + def set_data(self, value): + self.xml.text = bytes(base64.b64encode(value)).decode('utf-8') + + def del_data(self): + self.xml.text = '' -- cgit v1.2.3