Skip to content

Commit

Permalink
init folder watch command
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Dec 14, 2023
1 parent a68d297 commit 7fccdd8
Show file tree
Hide file tree
Showing 9 changed files with 329 additions and 7 deletions.
215 changes: 210 additions & 5 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ clap_mangen = "0.2"
console = "0.15.2"
dialoguer = "0.10.2"
dirs = "4.0"
email-lib = { version = "=0.17.1", default-features = false }
email-lib = { git = "https://git.sr.ht/~soywod/pimalaya", default-features = false }
email_address = "0.2.4"
env_logger = "0.8"
erased-serde = "0.3"
Expand Down
7 changes: 7 additions & 0 deletions config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ envelope.list.backend = "imap"
# Override the backend used for sending messages.
message.send.backend = "smtp"

# Send notification when receiving new messages
message.watch.received.notify.summary = "📬 New message from {sender}"
message.watch.received.notify.body = "{subject}"

# Shell commands can also be executed
# message.watch.received.cmd = "mbsync -a"

# IMAP config
imap.host = "localhost"
imap.port = 3143
Expand Down
8 changes: 8 additions & 0 deletions src/account/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ impl TomlAccountConfig {
.or_else(|| self.backend.as_ref())
}

pub fn get_watch_message_kind(&self) -> Option<&BackendKind> {
self.message
.as_ref()
.and_then(|msg| msg.watch.as_ref())
.and_then(|watch| watch.backend.as_ref())
.or_else(|| self.backend.as_ref())
}

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

Expand Down
Loading

0 comments on commit 7fccdd8

Please sign in to comment.