mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 01:46:34 +03:00
refactor: add MimeMessage.get_chat_group_id()
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -37,7 +37,7 @@ use crate::simplify;
|
||||
use crate::sql;
|
||||
use crate::stock_str;
|
||||
use crate::sync::Sync::*;
|
||||
use crate::tools::{self, buf_compress, extract_grpid_from_rfc724_mid, validate_id};
|
||||
use crate::tools::{self, buf_compress, extract_grpid_from_rfc724_mid};
|
||||
use crate::{chatlist_events, location};
|
||||
use crate::{contact, imap};
|
||||
|
||||
@@ -2431,10 +2431,7 @@ async fn apply_mailinglist_changes(
|
||||
}
|
||||
|
||||
fn try_getting_grpid(mime_parser: &MimeMessage) -> Option<String> {
|
||||
if let Some(optional_field) = mime_parser
|
||||
.get_header(HeaderDef::ChatGroupId)
|
||||
.filter(|s| validate_id(s))
|
||||
{
|
||||
if let Some(optional_field) = mime_parser.get_chat_group_id() {
|
||||
return Some(optional_field.clone());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user