Skip to content

Commit f4822c4

Browse files
committed
feat: remove show_emails config
1 parent 6829501 commit f4822c4

16 files changed

Lines changed: 13 additions & 162 deletions

File tree

deltachat-ffi/deltachat.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -440,12 +440,6 @@ char* dc_get_blobdir (const dc_context_t* context);
440440
* spam folder and `sendbox_watch` will also still be respected
441441
* if enabled.
442442
* 0=watch all folders normally (default)
443-
* - `show_emails` = DC_SHOW_EMAILS_OFF (0)=
444-
* show direct replies to chats only,
445-
* DC_SHOW_EMAILS_ACCEPTED_CONTACTS (1)=
446-
* also show all mails of confirmed contacts,
447-
* DC_SHOW_EMAILS_ALL (2)=
448-
* also show mails of unconfirmed contacts (default).
449443
* - `delete_device_after` = 0=do not delete messages from device automatically (default),
450444
* >=1=seconds, after which messages are deleted automatically from the device.
451445
* Messages in the "saved messages" chat (see dc_chat_is_self_talk()) are skipped.
@@ -454,8 +448,7 @@ char* dc_get_blobdir (const dc_context_t* context);
454448
* - `delete_server_after` = 0=do not delete messages from server automatically (default),
455449
* 1=delete messages directly after receiving from server, mvbox is skipped.
456450
* >1=seconds, after which messages are deleted automatically from the server, mvbox is used as defined.
457-
* "Saved messages" are deleted from the server as well as
458-
* e-mails matching the `show_emails` settings above, the UI should clearly point that out.
451+
* "Saved messages" are deleted from the server as well as emails, the UI should clearly point that out.
459452
* See also dc_estimate_deletion_cnt().
460453
* - `media_quality` = DC_MEDIA_QUALITY_BALANCED (0) =
461454
* good outgoing images/videos/voice quality at reasonable sizes (default)
@@ -1478,7 +1471,6 @@ dc_chatlist_t* dc_get_similar_chatlist (dc_context_t* context, uint32_t ch
14781471
* @param from_server 1=Estimate deletion count for server, 0=Estimate deletion count for device
14791472
* @param seconds Count messages older than the given number of seconds.
14801473
* @return Number of messages that are older than the given number of seconds.
1481-
* This includes e-mails downloaded due to the `show_emails` option.
14821474
* Messages in the "saved messages" folder are not counted as they will not be deleted automatically.
14831475
*/
14841476
int dc_estimate_deletion_cnt (dc_context_t* context, int from_server, int64_t seconds);
@@ -6712,14 +6704,6 @@ void dc_event_unref(dc_event_t* event);
67126704
#define DC_EVENT_DATA2_IS_STRING(e) ((e)==DC_EVENT_CONFIGURE_PROGRESS || (e)==DC_EVENT_IMEX_FILE_WRITTEN || ((e)>=100 && (e)<=499))
67136705

67146706

6715-
/*
6716-
* Values for dc_get|set_config("show_emails")
6717-
*/
6718-
#define DC_SHOW_EMAILS_OFF 0
6719-
#define DC_SHOW_EMAILS_ACCEPTED_CONTACTS 1
6720-
#define DC_SHOW_EMAILS_ALL 2
6721-
6722-
67236707
/*
67246708
* Values for dc_get|set_config("media_quality")
67256709
*/

src/chat/chat_tests.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,12 +1895,6 @@ async fn test_classic_email_chat() -> Result<()> {
18951895
let msgs = get_chat_msgs(&alice, chat_id).await?;
18961896
assert_eq!(msgs.len(), 1);
18971897

1898-
// Alice disables receiving classic emails.
1899-
alice
1900-
.set_config(Config::ShowEmails, Some("0"))
1901-
.await
1902-
.unwrap();
1903-
19041898
// Already received classic email should still be in the chat.
19051899
assert_eq!(chat_id.get_fresh_msg_cnt(&alice).await?, 1);
19061900

src/config.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ pub enum Config {
167167
#[strum(props(default = "0"))]
168168
OnlyFetchMvbox,
169169

170-
/// Whether to show classic emails or only chat messages.
171-
#[strum(props(default = "2"))] // also change ShowEmails.default() on changes
172-
ShowEmails,
173-
174170
/// Quality of the media files to send.
175171
#[strum(props(default = "0"))] // also change MediaQuality.default() on changes
176172
MediaQuality,
@@ -464,7 +460,6 @@ impl Config {
464460
Self::Displayname
465461
| Self::MdnsEnabled
466462
| Self::MvboxMove
467-
| Self::ShowEmails
468463
| Self::Selfavatar
469464
| Self::Selfstatus,
470465
)
@@ -714,7 +709,7 @@ impl Context {
714709
if n_transports > 1
715710
&& matches!(
716711
key,
717-
Config::MvboxMove | Config::OnlyFetchMvbox | Config::ShowEmails
712+
Config::MvboxMove | Config::OnlyFetchMvbox
718713
)
719714
{
720715
bail!("Cannot reconfigure {key} when multiple transports are configured");

src/config/config_tests.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,10 @@ async fn test_sync() -> Result<()> {
165165
sync(&alice0, &alice1).await;
166166
assert_eq!(alice1.get_config_bool(Config::MdnsEnabled).await?, false);
167167

168-
for key in [Config::ShowEmails, Config::MvboxMove] {
169-
let val = alice0.get_config_bool(key).await?;
170-
alice0.set_config_bool(key, !val).await?;
171-
sync(&alice0, &alice1).await;
172-
assert_eq!(alice1.get_config_bool(key).await?, !val);
173-
}
168+
let val = alice0.get_config_bool(Config::MvboxMove).await?;
169+
alice0.set_config_bool(Config::MvboxMove, !val).await?;
170+
sync(&alice0, &alice1).await;
171+
assert_eq!(alice1.get_config_bool(Config::MvboxMove).await?, !val);
174172

175173
// `Config::SyncMsgs` mustn't be synced.
176174
alice0.set_config_bool(Config::SyncMsgs, false).await?;

src/configure.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,6 @@ impl Context {
282282
"To use additional relays, disable the legacy option \"Settings / Advanced / Only Fetch from DeltaChat Folder\"."
283283
);
284284
}
285-
if self.get_config(Config::ShowEmails).await?.as_deref() != Some("2") {
286-
bail!(
287-
"To use additional relays, set the legacy option \"Settings / Advanced / Show Classic Emails\" to \"All\"."
288-
);
289-
}
290285

291286
if self
292287
.sql

src/constants.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,6 @@ pub enum Blocked {
3636
Request = 2,
3737
}
3838

39-
#[derive(
40-
Debug, Default, Display, Clone, Copy, PartialEq, Eq, FromPrimitive, ToPrimitive, FromSql, ToSql,
41-
)]
42-
#[repr(u8)]
43-
pub enum ShowEmails {
44-
Off = 0,
45-
AcceptedContacts = 1,
46-
#[default] // also change Config.ShowEmails props(default) on changes
47-
All = 2,
48-
}
49-
5039
#[derive(
5140
Debug, Default, Display, Clone, Copy, PartialEq, Eq, FromPrimitive, ToPrimitive, FromSql, ToSql,
5241
)]
@@ -277,18 +266,6 @@ mod tests {
277266
assert_eq!(Chattype::OutBroadcast, Chattype::from_i32(160).unwrap());
278267
}
279268

280-
#[test]
281-
fn test_showemails_values() {
282-
// values may be written to disk and must not change
283-
assert_eq!(ShowEmails::All, ShowEmails::default());
284-
assert_eq!(ShowEmails::Off, ShowEmails::from_i32(0).unwrap());
285-
assert_eq!(
286-
ShowEmails::AcceptedContacts,
287-
ShowEmails::from_i32(1).unwrap()
288-
);
289-
assert_eq!(ShowEmails::All, ShowEmails::from_i32(2).unwrap());
290-
}
291-
292269
#[test]
293270
fn test_blocked_values() {
294271
// values may be written to disk and must not change

src/context.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -945,10 +945,6 @@ impl Context {
945945
.await?
946946
.to_string(),
947947
);
948-
res.insert(
949-
"show_emails",
950-
self.get_config_int(Config::ShowEmails).await?.to_string(),
951-
);
952948
res.insert(
953949
"download_limit",
954950
self.get_config_int(Config::DownloadLimit)

src/html.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ mod tests {
281281
use super::*;
282282
use crate::chat;
283283
use crate::chat::{forward_msgs, save_msgs};
284-
use crate::config::Config;
285284
use crate::contact::ContactId;
286285
use crate::message::{MessengerMessage, Viewtype};
287286
use crate::receive_imf::receive_imf;
@@ -522,13 +521,7 @@ test some special html-characters as &lt; &gt; and &amp; but also &quot; and &#x
522521
async fn test_html_forwarding_encrypted() {
523522
let mut tcm = TestContextManager::new();
524523
// Alice receives a non-delta html-message
525-
// (`ShowEmails=AcceptedContacts` lets Alice actually receive non-delta messages for known
526-
// contacts, the contact is marked as known by creating a chat using `chat_with_contact()`)
527524
let alice = &tcm.alice().await;
528-
alice
529-
.set_config(Config::ShowEmails, Some("1"))
530-
.await
531-
.unwrap();
532525
let chat = alice
533526
.create_chat_with_contact("", "sender@testrun.org")
534527
.await;
@@ -546,10 +539,6 @@ test some special html-characters as &lt; &gt; and &amp; but also &quot; and &#x
546539

547540
// receive the message on another device
548541
let alice = &tcm.alice().await;
549-
alice
550-
.set_config(Config::ShowEmails, Some("0"))
551-
.await
552-
.unwrap();
553542
let msg = alice.recv_msg(&msg).await;
554543
assert_eq!(msg.chat_id, alice.get_self_chat().await.id);
555544
assert_eq!(msg.get_from_id(), ContactId::SELF);

src/imap.rs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ use async_imap::types::{Fetch, Flag, Name, NameAttribute, UnsolicitedResponse};
1919
use deltachat_contact_tools::ContactAddress;
2020
use futures::{FutureExt as _, TryStreamExt};
2121
use futures_lite::FutureExt;
22-
use num_traits::FromPrimitive;
2322
use ratelimit::Ratelimit;
2423
use url::Url;
2524

2625
use crate::calls::{create_fallback_ice_servers, create_ice_servers_from_metadata};
2726
use crate::chat::{self, ChatId, ChatIdBlocked, add_device_msg};
2827
use crate::chatlist_events;
2928
use crate::config::Config;
30-
use crate::constants::{self, Blocked, Chattype, DC_VERSION_STR, ShowEmails};
29+
use crate::constants::{self, Blocked, Chattype, DC_VERSION_STR};
3130
use crate::contact::{Contact, ContactId, Modifier, Origin};
3231
use crate::context::Context;
3332
use crate::events::EventType;
@@ -2317,7 +2316,7 @@ pub(crate) async fn prefetch_should_download(
23172316
Some(f) => f,
23182317
None => return Ok(false),
23192318
};
2320-
let (_from_id, blocked_contact, origin) =
2319+
let (_from_id, blocked_contact, _origin) =
23212320
match from_field_to_contact_id(context, &from, None, true, true).await? {
23222321
Some(res) => res,
23232322
None => return Ok(false),
@@ -2330,29 +2329,7 @@ pub(crate) async fn prefetch_should_download(
23302329
return Ok(false);
23312330
}
23322331

2333-
let is_chat_message = headers.get_header_value(HeaderDef::ChatVersion).is_some();
2334-
let accepted_contact = origin.is_known();
2335-
let is_reply_to_chat_message = get_prefetch_parent_message(context, headers)
2336-
.await?
2337-
.map(|parent| match parent.is_dc_message {
2338-
MessengerMessage::No => false,
2339-
MessengerMessage::Yes | MessengerMessage::Reply => true,
2340-
})
2341-
.unwrap_or_default();
2342-
2343-
let show_emails =
2344-
ShowEmails::from_i32(context.get_config_int(Config::ShowEmails).await?).unwrap_or_default();
2345-
2346-
let show = is_autocrypt_setup_message
2347-
|| match show_emails {
2348-
ShowEmails::Off => is_chat_message || is_reply_to_chat_message,
2349-
ShowEmails::AcceptedContacts => {
2350-
is_chat_message || is_reply_to_chat_message || accepted_contact
2351-
}
2352-
ShowEmails::All => true,
2353-
};
2354-
2355-
let should_download = (show && !blocked_contact) || maybe_ndn;
2332+
let should_download = !blocked_contact || maybe_ndn;
23562333
Ok(should_download)
23572334
}
23582335

src/message.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,6 @@ pub async fn get_request_msg_cnt(context: &Context) -> usize {
20182018
/// Count messages older than the given number of `seconds`.
20192019
///
20202020
/// Returns the number of messages that are older than the given number of seconds.
2021-
/// This includes e-mails downloaded due to the `show_emails` option.
20222021
/// Messages in the "saved messages" folder are not counted as they will not be deleted automatically.
20232022
pub async fn estimate_deletion_cnt(
20242023
context: &Context,

0 commit comments

Comments
 (0)