melib: add other_headers field in Envelope
Store headers with non-hardcoded names in a hash map.embed
parent
24831b3c13
commit
ee07aa8686
|
@ -22,7 +22,7 @@
|
||||||
/*!
|
/*!
|
||||||
* Email parsing, handling, sending etc.
|
* Email parsing, handling, sending etc.
|
||||||
*/
|
*/
|
||||||
|
use fnv::FnvHashMap;
|
||||||
mod compose;
|
mod compose;
|
||||||
pub use self::compose::*;
|
pub use self::compose::*;
|
||||||
|
|
||||||
|
@ -319,6 +319,7 @@ pub struct Envelope {
|
||||||
message_id: MessageID,
|
message_id: MessageID,
|
||||||
in_reply_to: Option<MessageID>,
|
in_reply_to: Option<MessageID>,
|
||||||
references: Option<References>,
|
references: Option<References>,
|
||||||
|
other_headers: FnvHashMap<String, String>,
|
||||||
|
|
||||||
timestamp: UnixTimestamp,
|
timestamp: UnixTimestamp,
|
||||||
thread: ThreadHash,
|
thread: ThreadHash,
|
||||||
|
@ -354,6 +355,7 @@ impl Envelope {
|
||||||
message_id: MessageID::default(),
|
message_id: MessageID::default(),
|
||||||
in_reply_to: None,
|
in_reply_to: None,
|
||||||
references: None,
|
references: None,
|
||||||
|
other_headers: FnvHashMap::default(),
|
||||||
|
|
||||||
timestamp: 0,
|
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(),
|
None => Vec::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub fn other_headers(&self) -> &FnvHashMap<String, String> {
|
||||||
|
&self.other_headers
|
||||||
|
}
|
||||||
pub fn thread(&self) -> ThreadHash {
|
pub fn thread(&self) -> ThreadHash {
|
||||||
self.thread
|
self.thread
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue