From 1e7afa9da00a415e3611f2857ee2aae3587194a4 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 2 Dec 2019 00:11:11 +0100 Subject: [PATCH] fix chat-verified --- Cargo.lock | 4 ++-- src/dc_receive_imf.rs | 2 +- src/message.rs | 2 +- src/mimefactory.rs | 11 +++++++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7422c1348..12ae271f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1397,7 +1397,7 @@ dependencies = [ [[package]] name = "lettre" version = "0.9.2" -source = "git+https://github.com/deltachat/lettre?branch=feat/mail#db7fe5fc06d4abb4c1cd70534310d1e0b1e79d57" +source = "git+https://github.com/deltachat/lettre?branch=feat/mail#00ba9db544059ddd60048f0b85d5052e4bf605da" dependencies = [ "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1416,7 +1416,7 @@ dependencies = [ [[package]] name = "lettre_email" version = "0.9.2" -source = "git+https://github.com/deltachat/lettre?branch=feat/mail#db7fe5fc06d4abb4c1cd70534310d1e0b1e79d57" +source = "git+https://github.com/deltachat/lettre?branch=feat/mail#00ba9db544059ddd60048f0b85d5052e4bf605da" dependencies = [ "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "email 0.0.21 (git+https://github.com/deltachat/rust-email)", diff --git a/src/dc_receive_imf.rs b/src/dc_receive_imf.rs index 1a6b47c74..aeef39cbf 100644 --- a/src/dc_receive_imf.rs +++ b/src/dc_receive_imf.rs @@ -1272,7 +1272,7 @@ fn create_or_lookup_adhoc_group( context.call_cb(Event::ChatModified(chat_id)); cleanup(ret_chat_id, ret_chat_id_blocked, chat_id, chat_id_blocked); - return Ok(()); + Ok(()) } fn create_group_record( diff --git a/src/message.rs b/src/message.rs index 555c511b7..f033aea16 100644 --- a/src/message.rs +++ b/src/message.rs @@ -458,7 +458,7 @@ impl Message { }; let contact = if self.from_id != DC_CONTACT_ID_SELF as libc::c_uint - && ((*chat).typ == Chattype::Group || (*chat).typ == Chattype::VerifiedGroup) + && (chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup) { Contact::get_by_id(context, self.from_id).ok() } else { diff --git a/src/mimefactory.rs b/src/mimefactory.rs index 62b732866..dfc3e7143 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -474,9 +474,12 @@ impl<'a, 'b> MimeFactory<'a, 'b> { let is_encrypted = should_encrypt && force_plaintext == 0; // Add gossip headers - info!(self.context, "gossip: {:?}", do_gossip); if do_gossip { - info!(self.context, "Gossip headers: {:?}", &peerstates); + info!( + self.context, + "gossiping headers for {} peerstates", + peerstates.len() + ); for peerstate in peerstates.iter().filter_map(|(state, _)| state.as_ref()) { if peerstate.peek_key(min_verified).is_some() { if let Some(header) = peerstate.render_gossip_header(min_verified) { @@ -604,6 +607,10 @@ impl<'a, 'b> MimeFactory<'a, 'b> { let mut placeholdertext = None; let mut meta_part = None; + if chat.typ == Chattype::VerifiedGroup { + protected_headers.push(Header::new("Chat-Verified".to_string(), "1".to_string())); + } + if chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup { protected_headers.push(Header::new("Chat-Group-ID".into(), chat.grpid.clone()));