summaryrefslogtreecommitdiffstats
path: root/ui/src/components/mail/view.rs
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2019-09-26 12:10:36 +0300
committerManos Pitsidianakis <el13635@mail.ntua.gr>2019-09-26 14:09:01 +0300
commitef338f353dc64783fcf0c30ce9e5b380c29ad701 (patch)
treee068f7c59d1aecf2d6fdf493101853c62f9be2d9 /ui/src/components/mail/view.rs
parentc44056a9ff33bec9aa2b74b656c6ebefcd73aaeb (diff)
ui: add PGP settings in configuration
Diffstat (limited to 'ui/src/components/mail/view.rs')
-rw-r--r--ui/src/components/mail/view.rs57
1 files changed, 37 insertions, 20 deletions
diff --git a/ui/src/components/mail/view.rs b/ui/src/components/mail/view.rs
index 315970aa..cd256f6c 100644
--- a/ui/src/components/mail/view.rs
+++ b/ui/src/components/mail/view.rs
@@ -195,11 +195,20 @@ impl MailView {
}
} else if a.is_signed() {
v.clear();
- match melib::signatures::verify_signature(a) {
- Ok((bytes, sig)) => {
- let bytes_file = create_temp_file(&bytes, None, None, true);
- let signature_file = create_temp_file(sig, None, None, true);
- if let Ok(gpg) = Command::new("gpg2")
+ if context.settings.pgp.auto_verify_signatures {
+ match melib::signatures::verify_signature(a) {
+ Ok((bytes, sig)) => {
+ let bytes_file = create_temp_file(&bytes, None, None, true);
+ let signature_file = create_temp_file(sig, None, None, true);
+ if let Ok(gpg) = Command::new(
+ context
+ .settings
+ .pgp
+ .gpg_binary
+ .as_ref()
+ .map(String::as_str)
+ .unwrap_or("gpg2"),
+ )
.args(&[
"--output",
"-",
@@ -210,27 +219,35 @@ impl MailView {
.stdin(Stdio::piped())
.stderr(Stdio::piped())
.spawn()
- {
- v.extend(gpg.wait_with_output().unwrap().stderr);
- } else {
- context.replies.push_back(UIEvent::Notification(
- Some(
- "Failed to find an application to verify PGP signature"
+ {
+ v.extend(gpg.wait_with_output().unwrap().stderr);
+ } else {
+ context.replies.push_back(UIEvent::Notification(
+ Some(format!(
+ "Failed to launch {} to verify PGP signature",
+ context
+ .settings
+ .pgp
+ .gpg_binary
+ .as_ref()
+ .map(String::as_str)
+ .unwrap_or("gpg2"),
+ )),
+ "see meli.conf(5) for configuration setting pgp.gpg_binary"
.to_string(),
- ),
+ Some(NotificationType::ERROR),
+ ));
+ return;
+ }
+ }
+ Err(e) => {
+ context.replies.push_back(UIEvent::Notification(
+ Some(e.to_string()),
String::new(),
Some(NotificationType::ERROR),
));
- return;
}
}
- Err(e) => {
- context.replies.push_back(UIEvent::Notification(
- Some(e.to_string()),
- String::new(),
- Some(NotificationType::ERROR),
- ));
- }
}
}
})),