mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-05 09:05:13 +00:00
review template, write and search commands
This commit is contained in:
parent
079572666a
commit
9931658ea3
|
@ -354,6 +354,7 @@ pub fn reply<
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Save a raw message to the targetted mailbox.
|
||||
pub fn save<ImapService: ImapServiceInterface>(
|
||||
mbox: Option<&str>,
|
||||
msg: &str,
|
||||
|
@ -367,6 +368,7 @@ pub fn save<ImapService: ImapServiceInterface>(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Search messages from the given IMAP query.
|
||||
pub fn search<OutputService: OutputServiceInterface, ImapService: ImapServiceInterface>(
|
||||
page_size: Option<usize>,
|
||||
page: usize,
|
||||
|
@ -388,6 +390,7 @@ pub fn search<OutputService: OutputServiceInterface, ImapService: ImapServiceInt
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Send a raw message.
|
||||
pub fn send<
|
||||
OutputService: OutputServiceInterface,
|
||||
ImapService: ImapServiceInterface,
|
||||
|
@ -422,6 +425,7 @@ pub fn send<
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Compose a new message.
|
||||
pub fn write<
|
||||
OutputService: OutputServiceInterface,
|
||||
ImapService: ImapServiceInterface,
|
||||
|
|
|
@ -79,15 +79,23 @@ fn override_msg_with_args<'a>(msg: &mut Msg, tpl: Tpl<'a>) {
|
|||
Some(from) => from.map(|arg| arg.to_string()).collect(),
|
||||
None => msg.headers.from.clone(),
|
||||
};
|
||||
|
||||
let to: Vec<String> = match tpl.to {
|
||||
Some(to) => to.map(|arg| arg.to_string()).collect(),
|
||||
None => Vec::new(),
|
||||
};
|
||||
|
||||
let subject = tpl.subject.map(String::from);
|
||||
let cc: Option<Vec<String>> = tpl.cc.map(|cc| cc.map(|arg| arg.to_string()).collect());
|
||||
let bcc: Option<Vec<String>> = tpl.bcc.map(|bcc| bcc.map(|arg| arg.to_string()).collect());
|
||||
let subject = tpl
|
||||
.subject
|
||||
.map(String::from)
|
||||
.or_else(|| msg.headers.subject.clone())
|
||||
.or_else(|| Some(String::new()));
|
||||
let cc: Option<Vec<String>> = tpl
|
||||
.cc
|
||||
.map(|cc| cc.map(|arg| arg.to_string()).collect())
|
||||
.or_else(|| msg.headers.cc.clone());
|
||||
let bcc: Option<Vec<String>> = tpl
|
||||
.bcc
|
||||
.map(|bcc| bcc.map(|arg| arg.to_string()).collect())
|
||||
.or_else(|| msg.headers.bcc.clone());
|
||||
|
||||
let custom_headers: Option<HashMap<String, Vec<String>>> = {
|
||||
if let Some(matched_headers) = tpl.headers {
|
||||
|
|
Loading…
Reference in a new issue