feat: Make dc_msg_get_filename() return the original attachment filename (#4309)

It can be used e.g. as a default in the file saving dialog. Also display the original filename in
the message info. For these purposes add Param::Filename in addition to Param::File and use it as an
attachment filename in sent emails.
This commit is contained in:
iequidoo
2023-07-26 14:28:40 -03:00
committed by iequidoo
parent 2f24eddb7d
commit 55aaec744a
13 changed files with 74 additions and 51 deletions

View File

@@ -21,6 +21,9 @@ pub enum Param {
/// For messages and jobs
File = b'f',
/// For messages: original filename (as shown in chat)
Filename = b'v',
/// For messages: This name should be shown instead of contact.get_display_name()
/// (used if this is a mailinglist
/// or explicitly set using set_override_sender_name(), eg. by bots)
@@ -528,7 +531,7 @@ mod tests {
fs::write(fname, b"boo").await.unwrap();
let blob = p.get_blob(Param::File, &t, true).await.unwrap().unwrap();
assert_eq!(blob, BlobObject::from_name(&t, "foo".to_string()).unwrap());
assert!(blob.as_file_name().starts_with("foo"));
// Blob in blobdir, expect blob.
let bar_path = t.get_blobdir().join("bar");