mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-17 05:07:55 +08:00
get signature from file (#135)
This commit is contained in:
@@ -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
|
||||
|
||||
+13
-4
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user