diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 4a14d7d3a..1372478ff 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -2769,7 +2769,6 @@ char* dc_chat_get_info_json (dc_context_t* context, size_t chat #define DC_CHAT_TYPE_UNDEFINED 0 #define DC_CHAT_TYPE_SINGLE 100 #define DC_CHAT_TYPE_GROUP 120 -#define DC_CHAT_TYPE_VERIFIED_GROUP 130 /** @@ -2810,9 +2809,6 @@ uint32_t dc_chat_get_id (const dc_chat_t* chat); * - DC_CHAT_TYPE_GROUP (120) - a group chat, chats_contacts contain all group * members, incl. DC_CONTACT_ID_SELF * - * - DC_CHAT_TYPE_VERIFIED_GROUP (130) - a verified group chat. In verified groups, - * all members are verified and encryption is always active and cannot be disabled. - * * @memberof dc_chat_t * @param chat The chat object. * @return Chat type. diff --git a/src/chat.rs b/src/chat.rs index e4b199b8e..da02fac37 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -786,15 +786,12 @@ impl Chat { let mut to_id = 0; let mut location_id = 0; - if !(self.typ == Chattype::Single - || self.typ == Chattype::Group - || self.typ == Chattype::VerifiedGroup) - { + if !(self.typ == Chattype::Single || self.typ == Chattype::Group) { error!(context, "Cannot send to chat type #{}.", self.typ,); bail!("Cannot set to chat type #{}", self.typ); } - if (self.typ == Chattype::Group || self.typ == Chattype::VerifiedGroup) + if self.typ == Chattype::Group && !is_contact_in_chat(context, self.id, DC_CONTACT_ID_SELF).await { emit_event!( @@ -811,7 +808,7 @@ impl Chat { let new_rfc724_mid = { let grpid = match self.typ { - Chattype::Group | Chattype::VerifiedGroup => Some(self.grpid.as_str()), + Chattype::Group => Some(self.grpid.as_str()), _ => None, }; dc_create_outgoing_rfc724_mid(grpid, &from) @@ -835,7 +832,7 @@ impl Chat { ); bail!("Cannot set message, contact for {} not found.", self.id); } - } else if (self.typ == Chattype::Group || self.typ == Chattype::VerifiedGroup) + } else if self.typ == Chattype::Group && self.param.get_int(Param::Unpromoted).unwrap_or_default() == 1 { msg.param.set_int(Param::AttachGroupImage, 1); @@ -2059,7 +2056,7 @@ pub(crate) async fn add_contact_to_chat_ex( } } else { // else continue and send status mail - if chat.typ == Chattype::VerifiedGroup + if chat.is_protected() && contact.is_verified(context).await != VerifiedStatus::BidirectVerified { error!( @@ -2102,7 +2099,7 @@ async fn real_group_exists(context: &Context, chat_id: ChatId) -> bool { context .sql .exists( - "SELECT id FROM chats WHERE id=? AND (type=120 OR type=130);", + "SELECT id FROM chats WHERE id=? AND type=120;", paramsv![chat_id], ) .await diff --git a/src/chatlist.rs b/src/chatlist.rs index 237540d6c..7b05169a1 100644 --- a/src/chatlist.rs +++ b/src/chatlist.rs @@ -362,9 +362,7 @@ impl Chatlist { let mut lastcontact = None; let lastmsg = if let Ok(lastmsg) = Message::load_from_db(context, lastmsg_id).await { - if lastmsg.from_id != DC_CONTACT_ID_SELF - && (chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup) - { + if lastmsg.from_id != DC_CONTACT_ID_SELF && chat.typ == Chattype::Group { lastcontact = Contact::load_from_db(context, lastmsg.from_id).await.ok(); } diff --git a/src/constants.rs b/src/constants.rs index b8a393520..c1b8b4b8e 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -145,7 +145,6 @@ pub enum Chattype { Undefined = 0, Single = 100, Group = 120, - VerifiedGroup = 130, } impl Default for Chattype { diff --git a/src/message.rs b/src/message.rs index 967e8efdd..28144eced 100644 --- a/src/message.rs +++ b/src/message.rs @@ -544,9 +544,7 @@ impl Message { return ret; }; - let contact = if self.from_id != DC_CONTACT_ID_SELF as u32 - && (chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup) - { + let contact = if self.from_id != DC_CONTACT_ID_SELF as u32 && chat.typ == Chattype::Group { Contact::get_by_id(context, self.from_id).await.ok() } else { None @@ -976,7 +974,7 @@ impl Lot { ); self.text1_meaning = Meaning::Text1Self; } - } else if chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup { + } else if chat.typ == Chattype::Group { if msg.is_info() || contact.is_none() { self.text1 = None; self.text1_meaning = Meaning::None; @@ -1661,7 +1659,7 @@ pub(crate) async fn handle_ndn( if let Ok((msg_id, chat_id, chat_type)) = res { set_msg_failed(context, msg_id, error).await; - if chat_type == Chattype::Group || chat_type == Chattype::VerifiedGroup { + if chat_type == Chattype::Group { if let Some(failed_recipient) = &failed.failed_recipient { let contact_id = Contact::lookup_id_by_addr(context, failed_recipient, Origin::Unknown).await; diff --git a/src/mimefactory.rs b/src/mimefactory.rs index c143ff066..22a9173e0 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -233,7 +233,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> { fn is_e2ee_guaranteed(&self) -> bool { match &self.loaded { Loaded::Message { chat } => { - if chat.typ == Chattype::VerifiedGroup { + if chat.is_protected() { return true; } @@ -255,7 +255,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> { fn min_verified(&self) -> PeerstateVerifiedStatus { match &self.loaded { Loaded::Message { chat } => { - if chat.typ == Chattype::VerifiedGroup { + if chat.is_protected() { PeerstateVerifiedStatus::BidirectVerified } else { PeerstateVerifiedStatus::Unverified @@ -268,7 +268,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> { fn should_force_plaintext(&self) -> bool { match &self.loaded { Loaded::Message { chat } => { - if chat.typ == Chattype::VerifiedGroup { + if chat.is_protected() { false } else { self.msg @@ -345,7 +345,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> { .stock_str(StockMessage::AcSetupMsgSubject) .await .into_owned() - } else if chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup { + } else if chat.typ == Chattype::Group { let re = if self.in_reply_to.is_empty() { "" } else { @@ -708,11 +708,11 @@ impl<'a, 'b> MimeFactory<'a, 'b> { let mut placeholdertext = None; let mut meta_part = None; - if chat.typ == Chattype::VerifiedGroup { + if chat.is_protected() { protected_headers.push(Header::new("Chat-Verified".to_string(), "1".to_string())); } - if chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup { + if chat.typ == Chattype::Group { protected_headers.push(Header::new("Chat-Group-ID".into(), chat.grpid.clone())); let encoded = encode_words(&chat.name);