changeset 1706:aa60bd58ac23

plugin (xml log): workaround for a crash on big stanzas
author Goffi <goffi@goffi.org>
date Mon, 30 Nov 2015 21:54:38 +0100
parents 3765e10ec52f
children 94c450972346
files src/plugins/plugin_misc_xmllog.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/plugin_misc_xmllog.py	Mon Nov 30 20:42:14 2015 +0100
+++ b/src/plugins/plugin_misc_xmllog.py	Mon Nov 30 21:54:38 2015 +0100
@@ -49,7 +49,9 @@
         return XmlStream.send(self, obj)
 
     def dataReceived(self, data):
-        self._host.bridge.xmlLog("IN", data.decode('utf-8'), self._profile)
+        # FIXME: we use "replace" here because a big stanza can be cut in the middle of a unicode char
+        #        this plugin should probably moved to a better place, where stanzas are fully received
+        self._host.bridge.xmlLog("IN", data.decode('utf-8', 'replace'), self._profile)
         return XmlStream.dataReceived(self, data)