summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2019-06-18 21:38:24 +0300
committerManos Pitsidianakis <el13635@mail.ntua.gr>2019-06-18 21:38:30 +0300
commitee07aa8686b7af465730b53fa13e369d85e571b0 (patch)
treef30864bbe44e544fe4053821ab6c9fa2e6c6b7ff
parent24831b3c13c351418d990e9c8ea94bbece223d97 (diff)
melib: add other_headers field in Envelope
Store headers with non-hardcoded names in a hash map.
-rw-r--r--melib/src/email.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/melib/src/email.rs b/melib/src/email.rs
index 367a8a22..b5eb5800 100644
--- a/melib/src/email.rs
+++ b/melib/src/email.rs
@@ -22,7 +22,7 @@
/*!
* Email parsing, handling, sending etc.
*/
-
+use fnv::FnvHashMap;
mod compose;
pub use self::compose::*;
@@ -319,6 +319,7 @@ pub struct Envelope {
message_id: MessageID,
in_reply_to: Option<MessageID>,
references: Option<References>,
+ other_headers: FnvHashMap<String, String>,
timestamp: UnixTimestamp,
thread: ThreadHash,
@@ -354,6 +355,7 @@ impl Envelope {
message_id: MessageID::default(),
in_reply_to: None,
references: None,
+ other_headers: FnvHashMap::default(),
timestamp: 0,
@@ -476,6 +478,11 @@ impl Envelope {
}
_ => {}
}
+ } else {
+ self.other_headers.insert(
+ String::from_utf8_lossy(name).into(),
+ String::from_utf8_lossy(value).into(),
+ );
}
}
/*
@@ -749,6 +756,9 @@ impl Envelope {
None => Vec::new(),
}
}
+ pub fn other_headers(&self) -> &FnvHashMap<String, String> {
+ &self.other_headers
+ }
pub fn thread(&self) -> ThreadHash {
self.thread
}