diff options
author | Philipp Hörist <philipp@hoerist.com> | 2019-11-04 00:07:00 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2019-11-04 00:07:00 +0300 |
commit | a335c9ec46651e029703a97a3d5ec2d46f68a077 (patch) | |
tree | 71cf25620f79c9dc01d5ce7a49a0b202ef532c9d /nbxmpp/modules | |
parent | 05e74605cf99c5955b3e09bd2b2c51c071416952 (diff) |
Revert "Refactor XHTML event code"
This reverts commit 05e74605cf99c5955b3e09bd2b2c51c071416952
Diffstat (limited to 'nbxmpp/modules')
-rw-r--r-- | nbxmpp/modules/message.py | 14 | ||||
-rw-r--r-- | nbxmpp/modules/misc.py | 14 |
2 files changed, 1 insertions, 27 deletions
diff --git a/nbxmpp/modules/message.py b/nbxmpp/modules/message.py index 8a708eb..27ef286 100644 --- a/nbxmpp/modules/message.py +++ b/nbxmpp/modules/message.py @@ -19,10 +19,8 @@ import logging from nbxmpp.protocol import NodeProcessed from nbxmpp.protocol import NS_DATA -from nbxmpp.protocol import NS_XHTML from nbxmpp.structs import StanzaHandler from nbxmpp.structs import StanzaIDData -from nbxmpp.structs import XHTMLData from nbxmpp.util import error_factory from nbxmpp.const import MessageType @@ -81,17 +79,7 @@ class BaseMessage: forms = stanza.getTags('x', namespace=NS_DATA) if forms: properties.forms = forms - - xhtml = stanza.getXHTML() - if xhtml is None: - return - - if xhtml.getTag('body', namespace=NS_XHTML) is None: - log.warning('xhtml without body found') - log.warning(stanza) - return - - properties.xhtml = XHTMLData(xhtml) + properties.xhtml = stanza.getXHTML() @staticmethod def _parse_type(stanza): diff --git a/nbxmpp/modules/misc.py b/nbxmpp/modules/misc.py index 02efa8c..4fdbf4e 100644 --- a/nbxmpp/modules/misc.py +++ b/nbxmpp/modules/misc.py @@ -22,7 +22,6 @@ from nbxmpp.protocol import NS_FORWARD from nbxmpp.protocol import NS_MUC_USER from nbxmpp.protocol import NS_MAM_1 from nbxmpp.protocol import NS_MAM_2 -from nbxmpp.protocol import NS_XHTML from nbxmpp.protocol import NodeProcessed from nbxmpp.protocol import InvalidFrom from nbxmpp.protocol import InvalidStanza @@ -119,16 +118,3 @@ def unwrap_mam(stanza, own_jid): archive=stanza.getFrom(), namespace=result.getNamespace(), timestamp=delay_timestamp) - - -def build_xhtml_body(xhtml, xmllang=None): - try: - if xmllang is not None: - body = '<body xmlns="%s" xml:lang="%s">%s</body>' % ( - NS_XHTML, xmllang, xhtml) - else: - body = '<body xmlns="%s">%s</body>' % (NS_XHTML, xhtml) - except Exception as error: - log.error('Error while building xhtml node: %s', error) - return None - return body |