mirror of
https://github.com/soywod/himalaya.git
synced 2025-04-16 14:23:35 +00:00
get signature from file (#135)
This commit is contained in:
parent
9ba0c75c58
commit
435932a501
2 changed files with 18 additions and 4 deletions
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- Get signature from file [#135]
|
||||
|
||||
## [0.3.1] - 2021-05-04
|
||||
|
||||
### Added
|
||||
|
@ -239,6 +243,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
[#131]: https://github.com/soywod/himalaya/issues/131
|
||||
[#132]: https://github.com/soywod/himalaya/issues/132
|
||||
[#133]: https://github.com/soywod/himalaya/issues/133
|
||||
[#135]: https://github.com/soywod/himalaya/issues/135
|
||||
[#136]: https://github.com/soywod/himalaya/issues/136
|
||||
[#138]: https://github.com/soywod/himalaya/issues/138
|
||||
[#141]: https://github.com/soywod/himalaya/issues/141
|
||||
|
|
|
@ -2,7 +2,14 @@ use error_chain::error_chain;
|
|||
use lettre::transport::smtp::authentication::Credentials as SmtpCredentials;
|
||||
use log::debug;
|
||||
use serde::Deserialize;
|
||||
use std::{collections::HashMap, env, fs::File, io::Read, path::PathBuf, thread};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
env,
|
||||
fs::{self, File},
|
||||
io::Read,
|
||||
path::PathBuf,
|
||||
thread,
|
||||
};
|
||||
use toml;
|
||||
|
||||
use crate::output::utils::run_cmd;
|
||||
|
@ -220,11 +227,13 @@ impl Config {
|
|||
}
|
||||
|
||||
pub fn signature(&self, account: &Account) -> Option<String> {
|
||||
account
|
||||
let sig = account
|
||||
.signature
|
||||
.as_ref()
|
||||
.or_else(|| self.signature.as_ref())
|
||||
.map(|sig| sig.to_owned())
|
||||
.or_else(|| self.signature.as_ref());
|
||||
|
||||
sig.and_then(|sig| fs::read_to_string(sig).ok())
|
||||
.or_else(|| sig.map(|sig| sig.to_owned()))
|
||||
}
|
||||
|
||||
pub fn default_page_size(&self, account: &Account) -> usize {
|
||||
|
|
Loading…
Add table
Reference in a new issue