Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/python-nbxmpp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/nbxmpp
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2019-10-14 18:06:06 +0300
committerPhilipp Hörist <philipp@hoerist.com>2019-10-14 18:06:06 +0300
commit8cc2f1d3e7babb442a259d21bad5635345f8466f (patch)
treec3b13bcffd09f06a9a769f6bcfe735ab13158ff8 /nbxmpp
parent22ddb4b89a8bdd94d96c7b4b0688117a2db17e86 (diff)
Add xhtml message attribute
Diffstat (limited to 'nbxmpp')
-rw-r--r--nbxmpp/modules/message.py1
-rw-r--r--nbxmpp/protocol.py8
-rw-r--r--nbxmpp/structs.py5
3 files changed, 11 insertions, 3 deletions
diff --git a/nbxmpp/modules/message.py b/nbxmpp/modules/message.py
index 5c18318..27ef286 100644
--- a/nbxmpp/modules/message.py
+++ b/nbxmpp/modules/message.py
@@ -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):
diff --git a/nbxmpp/protocol.py b/nbxmpp/protocol.py
index 7bad8c7..9b2acbb 100644
--- a/nbxmpp/protocol.py
+++ b/nbxmpp/protocol.py
@@ -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
diff --git a/nbxmpp/structs.py b/nbxmpp/structs.py
index 80aba76..98b28bc 100644
--- a/nbxmpp/structs.py
+++ b/nbxmpp/structs.py
@@ -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):