changeset 3394:23af257ae780

plugin XEP-0060: use `xml_tools.parse` instead of `wokkel.generic.parseXml`: `xml_tools.parse` does a better parsing, as wokkel's `parseXml` may be missing text nodes.
author Goffi <goffi@goffi.org>
date Thu, 12 Nov 2020 14:53:15 +0100
parents 2b6f69f6df8c
children d6a482a78bda
files sat/plugins/plugin_xep_0060.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0060.py	Thu Nov 12 14:53:15 2020 +0100
+++ b/sat/plugins/plugin_xep_0060.py	Thu Nov 12 14:53:15 2020 +0100
@@ -26,7 +26,6 @@
 from twisted.internet import reactor, defer
 from wokkel import disco
 from wokkel import data_form
-from wokkel import generic
 # XXX: sat_tmp.wokkel.pubsub is actually use instead of wokkel version
 #      mam and rsm come from sat_tmp.wokkel too
 from wokkel import pubsub
@@ -37,6 +36,7 @@
 from sat.core.log import getLogger
 from sat.core import exceptions
 from sat.tools import sat_defer
+from sat.tools import xml_tools
 from sat.tools.common import data_format
 
 
@@ -453,7 +453,7 @@
                   profile_key=C.PROF_KEY_NONE):
         client = self.host.getClient(profile_key)
         service = None if not service else jid.JID(service)
-        payload = generic.parseXml(payload.encode())
+        payload = xml_tools.parse(payload)
         extra = data_format.deserialise(extra_ser)
         d = self.sendItem(
             client, service, nodeIdentifier, payload, item_id or None, extra
@@ -466,7 +466,7 @@
         client = self.host.getClient(profile_key)
         service = None if not service else jid.JID(service)
         try:
-            items = [generic.parseXml(item.encode()) for item in items]
+            items = [xml_tools.parse(item) for item in items]
         except Exception as e:
             raise exceptions.DataError(_("Can't parse items: {msg}").format(
                 msg=e))