component AP gateway: handle attachments

This commit is contained in:
Goffi 2023-03-23 15:42:21 +01:00
commit c3f97ec712

View file

@ -263,7 +263,7 @@ class XEP_0448:
# XXX: for now, XEP-0447/XEP-0448 only allow to send one file per <message/>, thus
# we need to send each file in a separate message, in the same way as for
# plugin_sec_aesgcm.
attachments = data["extra"][C.MESS_KEY_ATTACHMENTS]
attachments = data["extra"][C.KEY_ATTACHMENTS]
if not data['message'] or data['message'] == {'': ''}:
extra_attachments = attachments[1:]
del attachments[1:]
@ -271,7 +271,7 @@ class XEP_0448:
# we have a message, we must send first attachment separately
extra_attachments = attachments[:]
attachments.clear()
del data["extra"][C.MESS_KEY_ATTACHMENTS]
del data["extra"][C.KEY_ATTACHMENTS]
if attachments:
if len(attachments) > 1:
@ -319,7 +319,7 @@ class XEP_0448:
message={'': ''},
subject=data['subject'],
mess_type=data['type'],
extra={C.MESS_KEY_ATTACHMENTS: [attachment]},
extra={C.KEY_ATTACHMENTS: [attachment]},
)
if ((not data['extra']