@@ -12,7 +12,6 @@ use std::time::Duration;
12
12
use anyhow:: { Context as _, Result , anyhow, bail, ensure} ;
13
13
use chrono:: TimeZone ;
14
14
use deltachat_contact_tools:: { ContactAddress , sanitize_bidi_characters, sanitize_single_line} ;
15
- use deltachat_derive:: { FromSql , ToSql } ;
16
15
use mail_builder:: mime:: MimePart ;
17
16
use serde:: { Deserialize , Serialize } ;
18
17
use strum_macros:: EnumIter ;
@@ -67,41 +66,6 @@ pub enum ChatItem {
67
66
} ,
68
67
}
69
68
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
-
105
69
/// The reason why messages cannot be sent to the chat.
106
70
///
107
71
/// The reason is mainly for logging and displaying in debug REPL, thus not translated.
@@ -1375,9 +1339,6 @@ pub struct Chat {
1375
1339
1376
1340
/// Duration of the chat being muted.
1377
1341
pub mute_duration : MuteDuration ,
1378
-
1379
- /// If the chat is protected (verified).
1380
- pub ( crate ) protected : ProtectionStatus ,
1381
1342
}
1382
1343
1383
1344
impl Chat {
@@ -1387,7 +1348,7 @@ impl Chat {
1387
1348
. sql
1388
1349
. query_row (
1389
1350
"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
1391
1352
FROM chats c
1392
1353
WHERE c.id=?;" ,
1393
1354
( chat_id, ) ,
@@ -1402,7 +1363,6 @@ impl Chat {
1402
1363
blocked : row. get :: < _ , Option < _ > > ( 5 ) ?. unwrap_or_default ( ) ,
1403
1364
is_sending_locations : row. get ( 6 ) ?,
1404
1365
mute_duration : row. get ( 7 ) ?,
1405
- protected : row. get ( 8 ) ?,
1406
1366
} ;
1407
1367
Ok ( c)
1408
1368
} ,
@@ -2425,27 +2385,21 @@ impl ChatIdBlocked {
2425
2385
_ => ( ) ,
2426
2386
}
2427
2387
2428
- let protected = contact_id == ContactId :: SELF || contact. is_verified ( context) . await ?;
2429
2388
let smeared_time = create_smeared_timestamp ( context) ;
2430
2389
2431
2390
let chat_id = context
2432
2391
. sql
2433
2392
. transaction ( move |transaction| {
2434
2393
transaction. execute (
2435
2394
"INSERT INTO chats
2436
- (type, name, param, blocked, created_timestamp, protected )
2437
- VALUES(?, ?, ?, ?, ?, ? )" ,
2395
+ (type, name, param, blocked, created_timestamp)
2396
+ VALUES(?, ?, ?, ?, ?)" ,
2438
2397
(
2439
2398
Chattype :: Single ,
2440
2399
chat_name,
2441
2400
params. to_string ( ) ,
2442
2401
create_blocked as u8 ,
2443
2402
smeared_time,
2444
- if protected {
2445
- ProtectionStatus :: Protected
2446
- } else {
2447
- ProtectionStatus :: Unprotected
2448
- } ,
2449
2403
) ,
2450
2404
) ?;
2451
2405
let chat_id = ChatId :: new (
@@ -4430,24 +4384,21 @@ pub(crate) async fn get_chat_cnt(context: &Context) -> Result<usize> {
4430
4384
}
4431
4385
}
4432
4386
4433
- /// Returns a tuple of `(chatid, is_protected, blocked)`.
4387
+ /// Returns a tuple of `(chatid, blocked)`.
4434
4388
pub ( crate ) async fn get_chat_id_by_grpid (
4435
4389
context : & Context ,
4436
4390
grpid : & str ,
4437
- ) -> Result < Option < ( ChatId , bool , Blocked ) > > {
4391
+ ) -> Result < Option < ( ChatId , Blocked ) > > {
4438
4392
context
4439
4393
. sql
4440
4394
. query_row_optional (
4441
- "SELECT id, blocked, protected FROM chats WHERE grpid=?;" ,
4395
+ "SELECT id, blocked FROM chats WHERE grpid=?;" ,
4442
4396
( grpid, ) ,
4443
4397
|row| {
4444
4398
let chat_id = row. get :: < _ , ChatId > ( 0 ) ?;
4445
4399
4446
4400
let b = row. get :: < _ , Option < Blocked > > ( 1 ) ?. unwrap_or_default ( ) ;
4447
- let p = row
4448
- . get :: < _ , Option < ProtectionStatus > > ( 2 ) ?
4449
- . unwrap_or_default ( ) ;
4450
- Ok ( ( chat_id, p == ProtectionStatus :: Protected , b) )
4401
+ Ok ( ( chat_id, b) )
4451
4402
} ,
4452
4403
)
4453
4404
. await
0 commit comments