From 8937201eed87d66a0cd4ad9a5ddfe672d6cc76d1 Mon Sep 17 00:00:00 2001 From: Goffi Date: Wed, 29 Jan 2020 17:39:00 +0100 Subject: [PATCH] plugin XEP-0280: handle CCed messages without "to" --- sat/plugins/plugin_xep_0280.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sat/plugins/plugin_xep_0280.py b/sat/plugins/plugin_xep_0280.py index 9775d58d..d3f1212b 100644 --- a/sat/plugins/plugin_xep_0280.py +++ b/sat/plugins/plugin_xep_0280.py @@ -144,7 +144,12 @@ class XEP_0280(object): 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(