comparison sat/plugins/plugin_xep_0045.py @ 2979:f44a95f566d2

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
author Goffi <goffi@goffi.org>
date Sun, 30 Jun 2019 15:52:30 +0200
parents fa1cc09df195
children 37b55d87d027
comparison
equal deleted inserted replaced
2978:bad0b4280b77 2979:f44a95f566d2
1190 # XXX: this hack is due to buggy behaviour seen in the wild because of the 1190 # XXX: this hack is due to buggy behaviour seen in the wild because of the
1191 # "mod_delay" prosody module being activated. This module add an 1191 # "mod_delay" prosody module being activated. This module add an
1192 # unexpected <delay> elements which break our workflow. 1192 # unexpected <delay> elements which break our workflow.
1193 log.warning(_(u"storing the unexpected message anyway, to avoid loss")) 1193 log.warning(_(u"storing the unexpected message anyway, to avoid loss"))
1194 # we have to restore URI which are stripped by wokkel parsing 1194 # we have to restore URI which are stripped by wokkel parsing
1195 for c in message.element.children: 1195 for c in message.element.elements():
1196 if c.uri is None: 1196 if c.uri is None:
1197 c.uri = C.NS_CLIENT 1197 c.uri = C.NS_CLIENT
1198 mess_data = self.client.messageProt.parseMessage(message.element) 1198 mess_data = self.client.messageProt.parseMessage(message.element)
1199 message.element._mess_data = mess_data 1199 message.element._mess_data = mess_data
1200 self._addToHistory(None, user, message) 1200 self._addToHistory(None, user, message)