Skip to content

Commit

Permalink
add message.delete.style config option
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Mar 23, 2024
1 parent a5ef14d commit ee9718a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 26 deletions.
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added systemd service in `assets/` folder.
- Added configuration option `message.delete.style` that can be either `folder` (deleted messages are moved to the Trash folder, default style) or `flag` (deleted messages receive the Deleted flag).

### Changed

- **Added back the search feature**: you can now give an optional filter and sort query at the end of the `envelope list` command. See `envelope list --help` or [pimalaya.org](https://pimalaya.org/himalaya/cli/master/usage/advanced/envelope/list.html#query) for more detail on the search API.
- Changed the `envelope list` folder argument due to the search query: it became a flag `--folder|-f`.
- Made the global `--config|-c` option repeatable: the first option is considered the path to the main config, and successive options are considered partial overrides [#184].
- Changed the `envelope list` options (see `envelope list --help` for more details):
- The folder argument became a flag `--folder <name>`.
- The query argument has been added at the end of the command to filter and sort results [#39].
- Improved `template {new,reply,forward}` command JSON output: they return now a JSON object with 3 properties:
- `content`: the content of the template
- `cursor.row`: the row at which the cursor should be placed by the interface using the template
- `cursor.col`: the column at which the cursor should be placed by the interface using the template

### Fixed

- Fixed watch IMAP envelopes when folder was empty [#179].
- Prevent parsing of undefined config options [#188].
- Prevented parsing of undefined config options [#188].

## [1.0.0-beta.3] - 2024-02-25

Expand Down
38 changes: 19 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ impl TomlConfig {
read: c.read.map(|c| c.remote),
write: c.write.map(|c| c.remote),
send: c.send.map(|c| c.remote),
delete: c.delete.map(Into::into),
#[cfg(feature = "account-sync")]
sync: c.sync,
}),
Expand Down
16 changes: 13 additions & 3 deletions src/email/message/config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use email::message::delete::config::DeleteMessageStyle;
#[cfg(feature = "account-sync")]
use email::message::sync::config::MessageSyncConfig;
use serde::{Deserialize, Serialize};
Expand All @@ -13,7 +14,7 @@ pub struct MessageConfig {
pub read: Option<MessageGetConfig>,
pub copy: Option<MessageCopyConfig>,
pub r#move: Option<MessageMoveConfig>,
pub delete: Option<MessageDeleteConfig>,
pub delete: Option<DeleteMessageConfig>,
#[cfg(feature = "account-sync")]
pub sync: Option<MessageSyncConfig>,
}
Expand Down Expand Up @@ -162,11 +163,20 @@ impl MessageMoveConfig {
}

#[derive(Clone, Debug, Default, Eq, PartialEq, Deserialize, Serialize)]
pub struct MessageDeleteConfig {
pub struct DeleteMessageConfig {
pub backend: Option<BackendKind>,
pub style: Option<DeleteMessageStyle>,
}

impl MessageDeleteConfig {
impl From<DeleteMessageConfig> for email::message::delete::config::DeleteMessageConfig {
fn from(config: DeleteMessageConfig) -> Self {
Self {
style: config.style,
}
}
}

impl DeleteMessageConfig {
pub fn get_used_backends(&self) -> HashSet<&BackendKind> {
let mut kinds = HashSet::default();

Expand Down

0 comments on commit ee9718a

Please sign in to comment.