@@ -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.
@@ -1373,9 +1337,6 @@ pub struct Chat {
13731337
13741338 /// Duration of the chat being muted.
13751339 pub mute_duration : MuteDuration ,
1376-
1377- /// If the chat is protected (verified).
1378- pub ( crate ) protected : ProtectionStatus ,
13791340}
13801341
13811342impl Chat {
@@ -1385,7 +1346,7 @@ impl Chat {
13851346 . sql
13861347 . query_row (
13871348 "SELECT c.type, c.name, c.grpid, c.param, c.archived,
1388- c.blocked, c.locations_send_until, c.muted_until, c.protected
1349+ c.blocked, c.locations_send_until, c.muted_until
13891350 FROM chats c
13901351 WHERE c.id=?;" ,
13911352 ( chat_id, ) ,
@@ -1400,7 +1361,6 @@ impl Chat {
14001361 blocked : row. get :: < _ , Option < _ > > ( 5 ) ?. unwrap_or_default ( ) ,
14011362 is_sending_locations : row. get ( 6 ) ?,
14021363 mute_duration : row. get ( 7 ) ?,
1403- protected : row. get ( 8 ) ?,
14041364 } ;
14051365 Ok ( c)
14061366 } ,
@@ -2423,27 +2383,21 @@ impl ChatIdBlocked {
24232383 _ => ( ) ,
24242384 }
24252385
2426- let protected = contact_id == ContactId :: SELF || contact. is_verified ( context) . await ?;
24272386 let smeared_time = create_smeared_timestamp ( context) ;
24282387
24292388 let chat_id = context
24302389 . sql
24312390 . transaction ( move |transaction| {
24322391 transaction. execute (
24332392 "INSERT INTO chats
2434- (type, name, param, blocked, created_timestamp, protected )
2435- VALUES(?, ?, ?, ?, ?, ? )" ,
2393+ (type, name, param, blocked, created_timestamp)
2394+ VALUES(?, ?, ?, ?, ?)" ,
24362395 (
24372396 Chattype :: Single ,
24382397 chat_name,
24392398 params. to_string ( ) ,
24402399 create_blocked as u8 ,
24412400 smeared_time,
2442- if protected {
2443- ProtectionStatus :: Protected
2444- } else {
2445- ProtectionStatus :: Unprotected
2446- } ,
24472401 ) ,
24482402 ) ?;
24492403 let chat_id = ChatId :: new (
@@ -4404,24 +4358,21 @@ pub(crate) async fn get_chat_cnt(context: &Context) -> Result<usize> {
44044358 }
44054359}
44064360
4407- /// Returns a tuple of `(chatid, is_protected, blocked)`.
4361+ /// Returns a tuple of `(chatid, blocked)`.
44084362pub ( crate ) async fn get_chat_id_by_grpid (
44094363 context : & Context ,
44104364 grpid : & str ,
4411- ) -> Result < Option < ( ChatId , bool , Blocked ) > > {
4365+ ) -> Result < Option < ( ChatId , Blocked ) > > {
44124366 context
44134367 . sql
44144368 . query_row_optional (
4415- "SELECT id, blocked, protected FROM chats WHERE grpid=?;" ,
4369+ "SELECT id, blocked FROM chats WHERE grpid=?;" ,
44164370 ( grpid, ) ,
44174371 |row| {
44184372 let chat_id = row. get :: < _ , ChatId > ( 0 ) ?;
44194373
44204374 let b = row. get :: < _ , Option < Blocked > > ( 1 ) ?. unwrap_or_default ( ) ;
4421- let p = row
4422- . get :: < _ , Option < ProtectionStatus > > ( 2 ) ?
4423- . unwrap_or_default ( ) ;
4424- Ok ( ( chat_id, p == ProtectionStatus :: Protected , b) )
4375+ Ok ( ( chat_id, b) )
44254376 } ,
44264377 )
44274378 . await
0 commit comments