Add :open attachments command (#31)

Fixes #27
This commit is contained in:
Benjamin Große 2023-01-28 12:29:06 +00:00 committed by Ulyssa
parent a1574c6b8d
commit 1d93461183
No known key found for this signature in database
GPG key ID: 1B3965A3D18B9B64
5 changed files with 96 additions and 24 deletions

View file

@ -81,9 +81,9 @@ pub enum MessageAction {
/// Download an attachment to the given path.
///
/// The [bool] argument controls whether to overwrite any already existing file at the
/// destination path.
Download(Option<String>, bool),
/// The second argument controls whether to overwrite any already existing file at the
/// destination path, or to open the attachment after downloading.
Download(Option<String>, DownloadFlags),
/// Edit a sent message.
Edit,
@ -95,6 +95,18 @@ pub enum MessageAction {
Reply,
}
bitflags::bitflags! {
pub struct DownloadFlags: u32 {
const NONE = 0b00000000;
/// Overwrite file if it already exists.
const FORCE = 0b00000001;
/// Open file after downloading.
const OPEN = 0b00000010;
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum RoomField {
Name,