refactor: add MimeMessage.get_chat_group_id()

This commit is contained in:
link2xt
2024-05-10 20:32:22 +00:00
parent 0541ecf22c
commit b6a461e3b7
2 changed files with 9 additions and 5 deletions

View File

@@ -36,6 +36,7 @@ use crate::simplify::{simplify, SimplifiedText};
use crate::sync::SyncItems;
use crate::tools::{
create_smeared_timestamp, get_filemeta, parse_receive_headers, smeared_time, truncate_by_lines,
validate_id,
};
use crate::{chatlist_events, location, stock_str, tools};
@@ -818,6 +819,12 @@ impl MimeMessage {
self.headers.get(headerdef.get_headername())
}
/// Returns `Chat-Group-ID` header value if it is a valid group ID.
pub fn get_chat_group_id(&self) -> Option<&String> {
self.get_header(HeaderDef::ChatGroupId)
.filter(|s| validate_id(s))
}
async fn parse_mime_recursive<'a>(
&'a mut self,
context: &'a Context,