add message.delete.style config option

This commit is contained in:
Clément DOUIN 2024-03-23 17:07:41 +01:00
parent a5ef14da9f
commit ee9718a482
No known key found for this signature in database
GPG key ID: 353E4A18EE0FAB72
4 changed files with 41 additions and 26 deletions

View file

@ -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

38
Cargo.lock generated
View file

@ -365,9 +365,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "backtrace"
version = "0.3.69"
version = "0.3.71"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d"
dependencies = [
"addr2line",
"cc",
@ -532,9 +532,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.5.0"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
[[package]]
name = "bzip2"
@ -1212,7 +1212,7 @@ dependencies = [
[[package]]
name = "email-lib"
version = "0.22.3"
source = "git+https://git.sr.ht/~soywod/pimalaya#ce5eca36eb82bbc8c560474a5c41adcc82fed4f3"
source = "git+https://git.sr.ht/~soywod/pimalaya#381b1ef4939be887330466a7fcbbb6487190ddee"
dependencies = [
"advisory-lock",
"anyhow",
@ -1263,7 +1263,7 @@ dependencies = [
[[package]]
name = "email-macros"
version = "0.0.2"
source = "git+https://git.sr.ht/~soywod/pimalaya#ce5eca36eb82bbc8c560474a5c41adcc82fed4f3"
source = "git+https://git.sr.ht/~soywod/pimalaya#381b1ef4939be887330466a7fcbbb6487190ddee"
dependencies = [
"quote",
"syn 2.0.53",
@ -2108,9 +2108,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "2.2.5"
version = "2.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [
"equivalent",
"hashbrown",
@ -2243,7 +2243,7 @@ dependencies = [
[[package]]
name = "keyring-lib"
version = "0.4.0"
source = "git+https://git.sr.ht/~soywod/pimalaya#ce5eca36eb82bbc8c560474a5c41adcc82fed4f3"
source = "git+https://git.sr.ht/~soywod/pimalaya#381b1ef4939be887330466a7fcbbb6487190ddee"
dependencies = [
"keyring",
"log",
@ -2543,7 +2543,7 @@ dependencies = [
[[package]]
name = "mml-lib"
version = "1.0.8"
source = "git+https://git.sr.ht/~soywod/pimalaya#ce5eca36eb82bbc8c560474a5c41adcc82fed4f3"
source = "git+https://git.sr.ht/~soywod/pimalaya#381b1ef4939be887330466a7fcbbb6487190ddee"
dependencies = [
"async-recursion",
"chumsky",
@ -2759,7 +2759,7 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
[[package]]
name = "oauth-lib"
version = "0.1.0"
source = "git+https://git.sr.ht/~soywod/pimalaya#ce5eca36eb82bbc8c560474a5c41adcc82fed4f3"
source = "git+https://git.sr.ht/~soywod/pimalaya#381b1ef4939be887330466a7fcbbb6487190ddee"
dependencies = [
"log",
"oauth2",
@ -3104,7 +3104,7 @@ dependencies = [
[[package]]
name = "pgp-lib"
version = "0.1.0"
source = "git+https://git.sr.ht/~soywod/pimalaya#ce5eca36eb82bbc8c560474a5c41adcc82fed4f3"
source = "git+https://git.sr.ht/~soywod/pimalaya#381b1ef4939be887330466a7fcbbb6487190ddee"
dependencies = [
"async-recursion",
"futures",
@ -3280,7 +3280,7 @@ dependencies = [
[[package]]
name = "process-lib"
version = "0.4.1"
source = "git+https://git.sr.ht/~soywod/pimalaya#ce5eca36eb82bbc8c560474a5c41adcc82fed4f3"
source = "git+https://git.sr.ht/~soywod/pimalaya#381b1ef4939be887330466a7fcbbb6487190ddee"
dependencies = [
"log",
"serde",
@ -3411,9 +3411,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.10.3"
version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15"
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [
"aho-corasick",
"memchr",
@ -3694,9 +3694,9 @@ dependencies = [
[[package]]
name = "rustls-pki-types"
version = "1.3.1"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ede67b28608b4c60685c7d54122d4400d90f62b40caee7700e700380a390fa8"
checksum = "868e20fada228fefaf6b652e00cc73623d54f8171e7352c18bb281571f2d92da"
[[package]]
name = "rustls-webpki"
@ -3776,7 +3776,7 @@ dependencies = [
[[package]]
name = "secret-lib"
version = "0.4.1"
source = "git+https://git.sr.ht/~soywod/pimalaya#ce5eca36eb82bbc8c560474a5c41adcc82fed4f3"
source = "git+https://git.sr.ht/~soywod/pimalaya#381b1ef4939be887330466a7fcbbb6487190ddee"
dependencies = [
"keyring-lib",
"log",
@ -3979,7 +3979,7 @@ dependencies = [
[[package]]
name = "shellexpand-utils"
version = "0.2.0"
source = "git+https://git.sr.ht/~soywod/pimalaya#ce5eca36eb82bbc8c560474a5c41adcc82fed4f3"
source = "git+https://git.sr.ht/~soywod/pimalaya#381b1ef4939be887330466a7fcbbb6487190ddee"
dependencies = [
"log",
"shellexpand",

View file

@ -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,
}),

View file

@ -1,3 +1,4 @@
use email::message::delete::config::DeleteMessageStyle;
#[cfg(feature = "account-sync")]
use email::message::sync::config::MessageSyncConfig;
use serde::{Deserialize, Serialize};
@ -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>,
}
@ -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();