diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-09-15 21:53:25 +0300 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2019-09-15 23:38:32 +0300 |
commit | 5cf620f43c09ccc2278aedf1908f20fa3926870c (patch) | |
tree | 61311ce449fc3dd02a9828662b158da9393c67e0 | |
parent | 9e2bfa22b10dbadfb39a78c477cfd3a3d44936cb (diff) |
ui: add two log entries
-rw-r--r-- | ui/src/components/mail/compose.rs | 34 | ||||
-rw-r--r-- | ui/src/state.rs | 1 |
2 files changed, 25 insertions, 10 deletions
diff --git a/ui/src/components/mail/compose.rs b/ui/src/components/mail/compose.rs index 1bbf730a..f62decfc 100644 --- a/ui/src/components/mail/compose.rs +++ b/ui/src/components/mail/compose.rs @@ -787,16 +787,30 @@ pub fn send_draft(context: &mut Context, account_cursor: usize, draft: Draft) -> } } if !failure { - context.replies.push_back(UIEvent::Notification( - Some("Sent.".into()), - format!( - "Mailer output: {:#?}", - msmtp - .wait_with_output() - .expect("Failed to wait on filter") - .stdout - ), - )); + let output = msmtp.wait().expect("Failed to wait on mailer"); + if output.success() { + context + .replies + .push_back(UIEvent::Notification(Some("Sent.".into()), String::new())); + } else { + if let Some(exit_code) = output.code() { + log( + format!( + "Could not send e-mail using `{}`: Process exited with {}", + cmd, exit_code + ), + ERROR, + ); + } else { + log( + format!( + "Could not send e-mail using `{}`: Process was killed by signal", + cmd + ), + ERROR, + ); + } + } } !failure } diff --git a/ui/src/state.rs b/ui/src/state.rs index 427394a1..2bf2edc8 100644 --- a/ui/src/state.rs +++ b/ui/src/state.rs @@ -199,6 +199,7 @@ impl State { }) .collect(); accounts.sort_by(|a, b| a.name().cmp(&b.name())); + log(format!("Initialized {} accounts.", accounts.len()), INFO); let _stdout = std::io::stdout(); _stdout.lock(); |