Download & decrypt uploaded attachements.

- Parse the "Chat-Upload-Url" header
- Add message::schedule_download function to schedule download job
- In the job download, decrypt, save
This commit is contained in:
Franz Heinzmann (Frando)
2020-06-14 01:02:09 +02:00
parent 1350495574
commit be4d91fcb3
8 changed files with 141 additions and 15 deletions

View File

@@ -371,6 +371,7 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
listmsgs <query>\n\
msginfo <msg-id>\n\
openfile <msg-id>\n\
download <msg-id>\n\
listfresh\n\
forward <msg-id> <chat-id>\n\
markseen <msg-id>\n\
@@ -900,6 +901,16 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
let filepath = filepath.unwrap();
open::that(filepath)?;
}
"download" => {
ensure!(!arg1.is_empty(), "Argument <msg-id> missing.");
let id = MsgId::new(arg1.parse()?);
let path = if !arg2.is_empty() {
Some(arg2.into())
} else {
None
};
message::schedule_download(&context, id, path).await?;
}
"listfresh" => {
let msglist = context.get_fresh_msgs().await;