slixmpp/sleekxmpp/plugins/xep_0332/stanza/data.py

31 lines
772 B
Python
Raw Normal View History

2015-01-28 19:03:40 -08:00
"""
SleekXMPP: The Sleek XMPP Library
Implementation of HTTP over XMPP transport
http://xmpp.org/extensions/xep-0332.html
Copyright (C) 2015 Riptide IO, sangeeth@riptideio.com
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from sleekxmpp.xmlstream import ElementBase
class HTTPData(ElementBase):
2015-01-28 19:03:40 -08:00
"""
The data element.
"""
name = 'data'
2015-02-05 04:05:04 -08:00
namespace = 'urn:xmpp:http'
2015-01-28 19:03:40 -08:00
interfaces = set(['data'])
2015-05-01 02:02:36 -07:00
plugin_attrib = 'data'
2015-02-05 04:05:04 -08:00
is_extension = True
2015-01-28 19:03:40 -08:00
2015-02-05 04:05:04 -08:00
def get_data(self, encoding='text'):
data = self._get_sub_text(encoding, None)
return str(data) if data is not None else data
2015-01-28 19:03:40 -08:00
def set_data(self, data, encoding='text'):
self._set_sub_text(encoding, text=data)