comparison sat/plugins/plugin_misc_attach.py @ 3182:f2bb57348587

plugin attach, XEP-0363: progress id can now be specified: progress id can be specified in options, using the "progress_id" option, this can be more handy for frontends to keep track of attachments progresses.
author Goffi <goffi@goffi.org>
date Sun, 23 Feb 2020 17:48:26 +0100
parents 5ff2cf7f0aba
children 883fb4981958
comparison
equal deleted inserted replaced
3181:5ff2cf7f0aba 3182:f2bb57348587
73 name = attachment["name"] 73 name = attachment["name"]
74 except KeyError: 74 except KeyError:
75 name = attachment["name"] = path.name 75 name = attachment["name"] = path.name
76 76
77 options = {} 77 options = {}
78 progress_id = attachment.get("progress_id")
79 if progress_id:
80 options["progress_id"] = attachment["progress_id"]
78 if client.encryption.isEncryptionRequested(data): 81 if client.encryption.isEncryptionRequested(data):
79 # FIXME: we should not use implementation specific value here 82 # FIXME: we should not use implementation specific value here
80 # but for not it's the only file encryption method available with 83 # but for not it's the only file encryption method available with
81 # with upload. 84 # with upload.
82 options['encryption'] = C.ENC_AES_GCM 85 options['encryption'] = C.ENC_AES_GCM
83 86
84 __, upload_d = await self._u.upload( 87 __, upload_d = await self._u.upload(
85 client, 88 client,
86 filepath=path, 89 filepath=path,
87 filename=name, 90 filename=name,
91 options=options,
88 ) 92 )
89 uploads_d.append(upload_d) 93 uploads_d.append(upload_d)
90 94
91 for attachment in to_delete: 95 for attachment in to_delete:
92 attachments.remove(attachment) 96 attachments.remove(attachment)