2015-01-29 03:03:40 +00: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 Data(ElementBase):
|
|
|
|
"""
|
|
|
|
The data element.
|
|
|
|
"""
|
|
|
|
name = 'data'
|
2015-02-05 12:05:04 +00:00
|
|
|
namespace = 'urn:xmpp:http'
|
2015-01-29 03:03:40 +00:00
|
|
|
interfaces = set(['data'])
|
|
|
|
plugin_attrib = 'data'
|
2015-02-05 12:05:04 +00:00
|
|
|
is_extension = True
|
2015-01-29 03:03:40 +00:00
|
|
|
|
2015-02-05 12:05:04 +00: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-29 03:03:40 +00:00
|
|
|
|
|
|
|
def set_data(self, data, encoding='text'):
|
|
|
|
self._set_sub_text(encoding, text=data)
|
|
|
|
|