@@ -12,7 +12,6 @@ use std::time::Duration;
1212use anyhow:: { Context as _, Result , anyhow, bail, ensure} ;
1313use chrono:: TimeZone ;
1414use deltachat_contact_tools:: { ContactAddress , sanitize_bidi_characters, sanitize_single_line} ;
15- use deltachat_derive:: { FromSql , ToSql } ;
1615use mail_builder:: mime:: MimePart ;
1716use serde:: { Deserialize , Serialize } ;
1817use strum_macros:: EnumIter ;
@@ -67,41 +66,6 @@ pub enum ChatItem {
6766 } ,
6867}
6968
70- /// Chat protection status.
71- #[ derive(
72- Debug ,
73- Default ,
74- Display ,
75- Clone ,
76- Copy ,
77- PartialEq ,
78- Eq ,
79- FromPrimitive ,
80- ToPrimitive ,
81- FromSql ,
82- ToSql ,
83- IntoStaticStr ,
84- Serialize ,
85- Deserialize ,
86- ) ]
87- #[ repr( u32 ) ]
88- pub enum ProtectionStatus {
89- /// Chat is not protected.
90- #[ default]
91- Unprotected = 0 ,
92-
93- /// Chat is protected.
94- ///
95- /// All members of the chat must be verified.
96- Protected = 1 ,
97- // `2` was never used as a value.
98-
99- // Chats don't break in Core v2 anymore. Chats with broken protection existing before the
100- // key-contacts migration are treated as `Unprotected`.
101- //
102- // ProtectionBroken = 3,
103- }
104-
10569/// The reason why messages cannot be sent to the chat.
10670///
10771/// The reason is mainly for logging and displaying in debug REPL, thus not translated.
@@ -1375,9 +1339,6 @@ pub struct Chat {
13751339
13761340 /// Duration of the chat being muted.
13771341 pub mute_duration : MuteDuration ,
1378-
1379- /// If the chat is protected (verified).
1380- pub ( crate ) protected : ProtectionStatus ,
13811342}
13821343
13831344impl Chat {
@@ -1387,7 +1348,7 @@ impl Chat {
13871348 . sql
13881349 . query_row (
13891350 "SELECT c.type, c.name, c.grpid, c.param, c.archived,
1390- c.blocked, c.locations_send_until, c.muted_until, c.protected
1351+ c.blocked, c.locations_send_until, c.muted_until
13911352 FROM chats c
13921353 WHERE c.id=?;" ,
13931354 ( chat_id, ) ,
@@ -1402,7 +1363,6 @@ impl Chat {
14021363 blocked : row. get :: < _ , Option < _ > > ( 5 ) ?. unwrap_or_default ( ) ,
14031364 is_sending_locations : row. get ( 6 ) ?,
14041365 mute_duration : row. get ( 7 ) ?,
1405- protected : row. get ( 8 ) ?,
14061366 } ;
14071367 Ok ( c)
14081368 } ,
@@ -2425,27 +2385,21 @@ impl ChatIdBlocked {
24252385 _ => ( ) ,
24262386 }
24272387
2428- let protected = contact_id == ContactId :: SELF || contact. is_verified ( context) . await ?;
24292388 let smeared_time = create_smeared_timestamp ( context) ;
24302389
24312390 let chat_id = context
24322391 . sql
24332392 . transaction ( move |transaction| {
24342393 transaction. execute (
24352394 "INSERT INTO chats
2436- (type, name, param, blocked, created_timestamp, protected )
2437- VALUES(?, ?, ?, ?, ?, ? )" ,
2395+ (type, name, param, blocked, created_timestamp)
2396+ VALUES(?, ?, ?, ?, ?)" ,
24382397 (
24392398 Chattype :: Single ,
24402399 chat_name,
24412400 params. to_string ( ) ,
24422401 create_blocked as u8 ,
24432402 smeared_time,
2444- if protected {
2445- ProtectionStatus :: Protected
2446- } else {
2447- ProtectionStatus :: Unprotected
2448- } ,
24492403 ) ,
24502404 ) ?;
24512405 let chat_id = ChatId :: new (
@@ -4421,24 +4375,21 @@ pub(crate) async fn get_chat_cnt(context: &Context) -> Result<usize> {
44214375 }
44224376}
44234377
4424- /// Returns a tuple of `(chatid, is_protected, blocked)`.
4378+ /// Returns a tuple of `(chatid, blocked)`.
44254379pub ( crate ) async fn get_chat_id_by_grpid (
44264380 context : & Context ,
44274381 grpid : & str ,
4428- ) -> Result < Option < ( ChatId , bool , Blocked ) > > {
4382+ ) -> Result < Option < ( ChatId , Blocked ) > > {
44294383 context
44304384 . sql
44314385 . query_row_optional (
4432- "SELECT id, blocked, protected FROM chats WHERE grpid=?;" ,
4386+ "SELECT id, blocked FROM chats WHERE grpid=?;" ,
44334387 ( grpid, ) ,
44344388 |row| {
44354389 let chat_id = row. get :: < _ , ChatId > ( 0 ) ?;
44364390
44374391 let b = row. get :: < _ , Option < Blocked > > ( 1 ) ?. unwrap_or_default ( ) ;
4438- let p = row
4439- . get :: < _ , Option < ProtectionStatus > > ( 2 ) ?
4440- . unwrap_or_default ( ) ;
4441- Ok ( ( chat_id, p == ProtectionStatus :: Protected , b) )
4392+ Ok ( ( chat_id, b) )
44424393 } ,
44434394 )
44444395 . await
0 commit comments