From c226b72b20734cbb1c82eb108efbdd65bcdd8c67 Mon Sep 17 00:00:00 2001 From: Goffi Date: Sun, 30 Jun 2019 15:52:30 +0200 Subject: [PATCH] core, plugin XEP-0045: fix crashes when changing URIs: When adding missing URIs in message, the "children" property was used instead of elements(). "children" not only return elements, and this was causing crashes. This may fix bug 294 rel 294 --- sat/core/xmpp.py | 2 +- sat/plugins/plugin_xep_0045.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sat/core/xmpp.py b/sat/core/xmpp.py index e32acaae..e8c2c46c 100644 --- a/sat/core/xmpp.py +++ b/sat/core/xmpp.py @@ -969,7 +969,7 @@ class SatMessageProtocol(xmppim.MessageProtocol): if message_elt.uri is None: # wokkel element parsing strip out root namespace message_elt.defaultUri = message_elt.uri = C.NS_CLIENT - for c in message_elt.children: + for c in message_elt.elements(): if c.uri is None: c.uri == C.NS_CLIENT elif message_elt.uri != C.NS_CLIENT: diff --git a/sat/plugins/plugin_xep_0045.py b/sat/plugins/plugin_xep_0045.py index f16f36ed..26e92114 100644 --- a/sat/plugins/plugin_xep_0045.py +++ b/sat/plugins/plugin_xep_0045.py @@ -1192,7 +1192,7 @@ class SatMUCClient(muc.MUCClient): # unexpected elements which break our workflow. log.warning(_(u"storing the unexpected message anyway, to avoid loss")) # we have to restore URI which are stripped by wokkel parsing - for c in message.element.children: + for c in message.element.elements(): if c.uri is None: c.uri = C.NS_CLIENT mess_data = self.client.messageProt.parseMessage(message.element)