crabmail

Static HTML email archive viewer in Rust
git clone git://git.alexwennerberg.com/crabmail
Log | Files | Refs | README | LICENSE

commit 2971d2593fc3b1bd751e6630d116acc2ab19659b
parent c62e7c3b2d53bc86ab0df7a6570bae7d3fd830ec
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Fri, 31 Dec 2021 17:38:46 -0800

msg id parser

Diffstat:
Msrc/main.rs | 18++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -449,7 +449,13 @@ fn local_parse_email(parsed_mail: &ParsedMail) -> Result<Email> { let headers = &parsed_mail.headers; let id = headers .get_first_value("message-id") - .context("No message ID")?; + .and_then(|m| { + msgidparse(&m).ok().and_then(|i| match i.len() { + 0 => None, + _ => Some(i[0].clone()), + }) + }) + .context("No valid message ID")?; if id.contains("..") { // dont hack me // id goes into filename. TODO more verification @@ -494,15 +500,7 @@ fn local_parse_email(parsed_mail: &ParsedMail) -> Result<Email> { // if [arg] has cur,new,tmp -> that is the index // else, do each subfolder -// Used when we have more than 1 maildir folder -struct Index {} - -impl Index { - fn write_file() -> Result<()> { - template("Hello, my name is {name}!", &[("name", "nanotemplate")]); - Ok(()) - } -} +fn write_index() {} fn main() -> Result<()> { let args = arg::Args::from_env();