mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +00:00
07018c0afa
* added stanza unhandled (unhandled iqs now reply with feature-not-implemented) * added stanza exceptions (stanzas may now reply with exceptions when their handler raises an exception)
27 lines
698 B
Python
27 lines
698 B
Python
from .. xmlstream.stanzabase import ElementBase, ET
|
|
|
|
class HTMLIM(ElementBase):
|
|
namespace = 'http://jabber.org/protocol/xhtml-im'
|
|
name = 'html'
|
|
plugin_attrib = 'html'
|
|
interfaces = set(('html'))
|
|
plugin_attrib_map = set()
|
|
plugin_xml_map = set()
|
|
|
|
def setHtml(self, html):
|
|
if issinstance(html, str):
|
|
html = ET.XML(html)
|
|
if html.find('{http://www.w3.org/1999/xhtml}body') is None:
|
|
body = ET.Element('{http://www.w3.org/1999/xhtml}body')
|
|
body.append(html)
|
|
else:
|
|
body = html
|
|
self.xml.append(html)
|
|
|
|
def getHtml(self):
|
|
html = self.xml.find('{http://www.w3.org/1999/xhtml}body')
|
|
if html is None: return ''
|
|
return __str__(html)
|
|
|
|
def delHtml(self):
|
|
return self.__del__()
|