changeset 3141:49962f9a238a

plugin XEP-0280: handle CCed messages without "to"
author Goffi <goffi@goffi.org>
date Wed, 29 Jan 2020 17:39:00 +0100
parents 46a6251713d3
children cd90c24b2836
files sat/plugins/plugin_xep_0280.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0280.py	Wed Jan 29 12:38:48 2020 +0100
+++ b/sat/plugins/plugin_xep_0280.py	Wed Jan 29 17:39:00 2020 +0100
@@ -144,7 +144,12 @@
         if carbons_elt.name == "received":
             message_elt["from"] = cc_message_elt["from"]
         elif carbons_elt.name == "sent":
-            message_elt["to"] = cc_message_elt["to"]
+            try:
+                message_elt["to"] = cc_message_elt["to"]
+            except KeyError:
+                # we may not have "to" in case of message from ourself (from an other
+                # device)
+                pass
         else:
             log.warning(
                 "invalid message carbons received:\n{xml}".format(