mirror of
https://github.com/chatmail/core.git
synced 2026-05-05 22:36:30 +03:00
remove DC_CHAT_TYPE_VERIFIED_GROUP resp. Chattype::VerifiedGroup
This commit is contained in:
@@ -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_UNDEFINED 0
|
||||||
#define DC_CHAT_TYPE_SINGLE 100
|
#define DC_CHAT_TYPE_SINGLE 100
|
||||||
#define DC_CHAT_TYPE_GROUP 120
|
#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
|
* - DC_CHAT_TYPE_GROUP (120) - a group chat, chats_contacts contain all group
|
||||||
* members, incl. DC_CONTACT_ID_SELF
|
* 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
|
* @memberof dc_chat_t
|
||||||
* @param chat The chat object.
|
* @param chat The chat object.
|
||||||
* @return Chat type.
|
* @return Chat type.
|
||||||
|
|||||||
15
src/chat.rs
15
src/chat.rs
@@ -786,15 +786,12 @@ impl Chat {
|
|||||||
let mut to_id = 0;
|
let mut to_id = 0;
|
||||||
let mut location_id = 0;
|
let mut location_id = 0;
|
||||||
|
|
||||||
if !(self.typ == Chattype::Single
|
if !(self.typ == Chattype::Single || self.typ == Chattype::Group) {
|
||||||
|| self.typ == Chattype::Group
|
|
||||||
|| self.typ == Chattype::VerifiedGroup)
|
|
||||||
{
|
|
||||||
error!(context, "Cannot send to chat type #{}.", self.typ,);
|
error!(context, "Cannot send to chat type #{}.", self.typ,);
|
||||||
bail!("Cannot set 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
|
&& !is_contact_in_chat(context, self.id, DC_CONTACT_ID_SELF).await
|
||||||
{
|
{
|
||||||
emit_event!(
|
emit_event!(
|
||||||
@@ -811,7 +808,7 @@ impl Chat {
|
|||||||
|
|
||||||
let new_rfc724_mid = {
|
let new_rfc724_mid = {
|
||||||
let grpid = match self.typ {
|
let grpid = match self.typ {
|
||||||
Chattype::Group | Chattype::VerifiedGroup => Some(self.grpid.as_str()),
|
Chattype::Group => Some(self.grpid.as_str()),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
dc_create_outgoing_rfc724_mid(grpid, &from)
|
dc_create_outgoing_rfc724_mid(grpid, &from)
|
||||||
@@ -835,7 +832,7 @@ impl Chat {
|
|||||||
);
|
);
|
||||||
bail!("Cannot set message, contact for {} not found.", self.id);
|
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
|
&& self.param.get_int(Param::Unpromoted).unwrap_or_default() == 1
|
||||||
{
|
{
|
||||||
msg.param.set_int(Param::AttachGroupImage, 1);
|
msg.param.set_int(Param::AttachGroupImage, 1);
|
||||||
@@ -2059,7 +2056,7 @@ pub(crate) async fn add_contact_to_chat_ex(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// else continue and send status mail
|
// else continue and send status mail
|
||||||
if chat.typ == Chattype::VerifiedGroup
|
if chat.is_protected()
|
||||||
&& contact.is_verified(context).await != VerifiedStatus::BidirectVerified
|
&& contact.is_verified(context).await != VerifiedStatus::BidirectVerified
|
||||||
{
|
{
|
||||||
error!(
|
error!(
|
||||||
@@ -2102,7 +2099,7 @@ async fn real_group_exists(context: &Context, chat_id: ChatId) -> bool {
|
|||||||
context
|
context
|
||||||
.sql
|
.sql
|
||||||
.exists(
|
.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],
|
paramsv![chat_id],
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
|
|||||||
@@ -362,9 +362,7 @@ impl Chatlist {
|
|||||||
let mut lastcontact = None;
|
let mut lastcontact = None;
|
||||||
|
|
||||||
let lastmsg = if let Ok(lastmsg) = Message::load_from_db(context, lastmsg_id).await {
|
let lastmsg = if let Ok(lastmsg) = Message::load_from_db(context, lastmsg_id).await {
|
||||||
if lastmsg.from_id != DC_CONTACT_ID_SELF
|
if lastmsg.from_id != DC_CONTACT_ID_SELF && chat.typ == Chattype::Group {
|
||||||
&& (chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup)
|
|
||||||
{
|
|
||||||
lastcontact = Contact::load_from_db(context, lastmsg.from_id).await.ok();
|
lastcontact = Contact::load_from_db(context, lastmsg.from_id).await.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ pub enum Chattype {
|
|||||||
Undefined = 0,
|
Undefined = 0,
|
||||||
Single = 100,
|
Single = 100,
|
||||||
Group = 120,
|
Group = 120,
|
||||||
VerifiedGroup = 130,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Chattype {
|
impl Default for Chattype {
|
||||||
|
|||||||
@@ -544,9 +544,7 @@ impl Message {
|
|||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
let contact = if self.from_id != DC_CONTACT_ID_SELF as u32
|
let contact = if self.from_id != DC_CONTACT_ID_SELF as u32 && chat.typ == Chattype::Group {
|
||||||
&& (chat.typ == Chattype::Group || chat.typ == Chattype::VerifiedGroup)
|
|
||||||
{
|
|
||||||
Contact::get_by_id(context, self.from_id).await.ok()
|
Contact::get_by_id(context, self.from_id).await.ok()
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@@ -976,7 +974,7 @@ impl Lot {
|
|||||||
);
|
);
|
||||||
self.text1_meaning = Meaning::Text1Self;
|
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() {
|
if msg.is_info() || contact.is_none() {
|
||||||
self.text1 = None;
|
self.text1 = None;
|
||||||
self.text1_meaning = Meaning::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 {
|
if let Ok((msg_id, chat_id, chat_type)) = res {
|
||||||
set_msg_failed(context, msg_id, error).await;
|
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 {
|
if let Some(failed_recipient) = &failed.failed_recipient {
|
||||||
let contact_id =
|
let contact_id =
|
||||||
Contact::lookup_id_by_addr(context, failed_recipient, Origin::Unknown).await;
|
Contact::lookup_id_by_addr(context, failed_recipient, Origin::Unknown).await;
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
fn is_e2ee_guaranteed(&self) -> bool {
|
fn is_e2ee_guaranteed(&self) -> bool {
|
||||||
match &self.loaded {
|
match &self.loaded {
|
||||||
Loaded::Message { chat } => {
|
Loaded::Message { chat } => {
|
||||||
if chat.typ == Chattype::VerifiedGroup {
|
if chat.is_protected() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
fn min_verified(&self) -> PeerstateVerifiedStatus {
|
fn min_verified(&self) -> PeerstateVerifiedStatus {
|
||||||
match &self.loaded {
|
match &self.loaded {
|
||||||
Loaded::Message { chat } => {
|
Loaded::Message { chat } => {
|
||||||
if chat.typ == Chattype::VerifiedGroup {
|
if chat.is_protected() {
|
||||||
PeerstateVerifiedStatus::BidirectVerified
|
PeerstateVerifiedStatus::BidirectVerified
|
||||||
} else {
|
} else {
|
||||||
PeerstateVerifiedStatus::Unverified
|
PeerstateVerifiedStatus::Unverified
|
||||||
@@ -268,7 +268,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
fn should_force_plaintext(&self) -> bool {
|
fn should_force_plaintext(&self) -> bool {
|
||||||
match &self.loaded {
|
match &self.loaded {
|
||||||
Loaded::Message { chat } => {
|
Loaded::Message { chat } => {
|
||||||
if chat.typ == Chattype::VerifiedGroup {
|
if chat.is_protected() {
|
||||||
false
|
false
|
||||||
} else {
|
} else {
|
||||||
self.msg
|
self.msg
|
||||||
@@ -345,7 +345,7 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
.stock_str(StockMessage::AcSetupMsgSubject)
|
.stock_str(StockMessage::AcSetupMsgSubject)
|
||||||
.await
|
.await
|
||||||
.into_owned()
|
.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() {
|
let re = if self.in_reply_to.is_empty() {
|
||||||
""
|
""
|
||||||
} else {
|
} else {
|
||||||
@@ -708,11 +708,11 @@ impl<'a, 'b> MimeFactory<'a, 'b> {
|
|||||||
let mut placeholdertext = None;
|
let mut placeholdertext = None;
|
||||||
let mut meta_part = 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()));
|
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()));
|
protected_headers.push(Header::new("Chat-Group-ID".into(), chat.grpid.clone()));
|
||||||
|
|
||||||
let encoded = encode_words(&chat.name);
|
let encoded = encode_words(&chat.name);
|
||||||
|
|||||||
Reference in New Issue
Block a user