Commit 8cc2f1d3 authored by Philipp Hörist's avatar Philipp Hörist

Add xhtml message attribute

parent 22ddb4b8
......@@ -79,6 +79,7 @@ class BaseMessage:
forms = stanza.getTags('x', namespace=NS_DATA)
if forms:
properties.forms = forms
properties.xhtml = stanza.getXHTML()
@staticmethod
def _parse_type(stanza):
......
......@@ -1243,12 +1243,14 @@ class Message(Protocol):
TODO: Returning a DOM could make rendering faster.
"""
xhtml = self.getTag('html')
xhtml = self.getTag('html', namespace=NS_XHTML_IM)
if xhtml:
if xmllang:
body = xhtml.getTag('body', attrs={'xml:lang': xmllang})
body = xhtml.getTag('body',
namespace=NS_XHTML,
attrs={'xml:lang': xmllang})
else:
body = xhtml.getTag('body')
body = xhtml.getTag('body', namespace=NS_XHTML)
return str(body)
return None
......
......@@ -553,6 +553,7 @@ class MessageProperties:
self.correction = None
self.attention = False
self.forms = None
self.xhtml = None
@property
def has_user_delay(self):
......@@ -649,6 +650,10 @@ class MessageProperties:
def has_forms(self):
return self.forms is not None
@property
def has_xhtml(self):
return self.xhtml is not None
class IqProperties:
def __init__(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment