comparison sat/plugins/plugin_xep_0280.py @ 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 559a625a236b
children dcebc585c29f
comparison
equal deleted inserted replaced
3140:46a6251713d3 3141:49962f9a238a
142 # we replace the wrapping message with the CCed one 142 # we replace the wrapping message with the CCed one
143 # and continue the normal behaviour 143 # and continue the normal behaviour
144 if carbons_elt.name == "received": 144 if carbons_elt.name == "received":
145 message_elt["from"] = cc_message_elt["from"] 145 message_elt["from"] = cc_message_elt["from"]
146 elif carbons_elt.name == "sent": 146 elif carbons_elt.name == "sent":
147 message_elt["to"] = cc_message_elt["to"] 147 try:
148 message_elt["to"] = cc_message_elt["to"]
149 except KeyError:
150 # we may not have "to" in case of message from ourself (from an other
151 # device)
152 pass
148 else: 153 else:
149 log.warning( 154 log.warning(
150 "invalid message carbons received:\n{xml}".format( 155 "invalid message carbons received:\n{xml}".format(
151 xml=message_elt.toXml() 156 xml=message_elt.toXml()
152 ) 157 )