Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0184.py @ 3129:95befc85e816
plugin XEP-0184: show a warning and the message XML on missing `id`
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 27 Jan 2020 19:53:31 +0100 |
parents | ab2696e34d29 |
children | 559a625a236b |
comparison
equal
deleted
inserted
replaced
3128:73b5228715e8 | 3129:95befc85e816 |
---|---|
150 @param client: %(doc_client)s""" | 150 @param client: %(doc_client)s""" |
151 from_jid = jid.JID(msg_elt["from"]) | 151 from_jid = jid.JID(msg_elt["from"]) |
152 | 152 |
153 if self._isActif(client.profile) and client.roster.isPresenceAuthorised(from_jid): | 153 if self._isActif(client.profile) and client.roster.isPresenceAuthorised(from_jid): |
154 received_elt_ret = domish.Element((NS_MESSAGE_DELIVERY_RECEIPTS, "received")) | 154 received_elt_ret = domish.Element((NS_MESSAGE_DELIVERY_RECEIPTS, "received")) |
155 received_elt_ret["id"] = msg_elt["id"] | 155 try: |
156 received_elt_ret["id"] = msg_elt["id"] | |
157 except KeyError: | |
158 log.warning(f"missing id for message element: {msg_elt.toXml}") | |
159 return | |
156 | 160 |
157 msg_result_elt = xmlstream.toResponse(msg_elt, "result") | 161 msg_result_elt = xmlstream.toResponse(msg_elt, "result") |
158 msg_result_elt.addChild(received_elt_ret) | 162 msg_result_elt.addChild(received_elt_ret) |
159 client.send(msg_result_elt) | 163 client.send(msg_result_elt) |
160 | 164 |