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
|
|
|
|
|
|
|
|
|
2015-04-29 09:14:25 +00:00
|
|
|
class HTTPData(ElementBase):
|
2015-01-29 03:03:40 +00:00
|
|
|
"""
|
|
|
|
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'])
|
2015-05-01 09:02:36 +00:00
|
|
|
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)
|
|
|
|
|