Skip to content

Commit 37462b3

Browse files
committed
api!: deprecate DC_SHOW_EMAILS_ACCEPTED_CONTACTS
1 parent b0508e6 commit 37462b3

File tree

7 files changed

+17
-25
lines changed

7 files changed

+17
-25
lines changed

deltachat-ffi/deltachat.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,10 @@ char* dc_get_blobdir (const dc_context_t* context);
436436
* 0=watch all folders normally (default)
437437
* - `show_emails` = DC_SHOW_EMAILS_OFF (0)=
438438
* show direct replies to chats only,
439-
* DC_SHOW_EMAILS_ACCEPTED_CONTACTS (1)=
440-
* also show all mails of confirmed contacts,
439+
* DC_SHOW_EMAILS_ALL1 (1)=
440+
* deprecated, same as DC_SHOW_EMAILS_ALL,
441441
* DC_SHOW_EMAILS_ALL (2)=
442-
* also show mails of unconfirmed contacts (default).
442+
* show all mails (default).
443443
* - `delete_device_after` = 0=do not delete messages from device automatically (default),
444444
* >=1=seconds, after which messages are deleted automatically from the device.
445445
* Messages in the "saved messages" chat (see dc_chat_is_self_talk()) are skipped.
@@ -6582,7 +6582,7 @@ void dc_event_unref(dc_event_t* event);
65826582
* Values for dc_get|set_config("show_emails")
65836583
*/
65846584
#define DC_SHOW_EMAILS_OFF 0
6585-
#define DC_SHOW_EMAILS_ACCEPTED_CONTACTS 1
6585+
#define DC_SHOW_EMAILS_ALL1 1
65866586
#define DC_SHOW_EMAILS_ALL 2
65876587

65886588

deltachat-rpc-client/src/deltachat_rpc_client/const.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ class ShowEmails(IntEnum):
234234
"""Show emails mode."""
235235

236236
OFF = 0
237-
ACCEPTED_CONTACTS = 1
238237
ALL = 2
239238

240239

src/constants.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ pub enum Blocked {
4545
#[repr(u8)]
4646
pub enum ShowEmails {
4747
Off = 0,
48-
AcceptedContacts = 1,
49-
#[default] // also change Config.ShowEmails props(default) on changes
48+
49+
/// Deprecated 2025-04-16, same as All.
50+
All1 = 1,
51+
52+
// also change Config.ShowEmails props(default) on changes
53+
#[default]
5054
All = 2,
5155
}
5256

@@ -253,10 +257,7 @@ mod tests {
253257
// values may be written to disk and must not change
254258
assert_eq!(ShowEmails::All, ShowEmails::default());
255259
assert_eq!(ShowEmails::Off, ShowEmails::from_i32(0).unwrap());
256-
assert_eq!(
257-
ShowEmails::AcceptedContacts,
258-
ShowEmails::from_i32(1).unwrap()
259-
);
260+
assert_eq!(ShowEmails::All1, ShowEmails::from_i32(1).unwrap());
260261
assert_eq!(ShowEmails::All, ShowEmails::from_i32(2).unwrap());
261262
}
262263

src/html.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ test some special html-characters as < > and & but also " and &#x
522522
async fn test_html_forwarding_encrypted() {
523523
let mut tcm = TestContextManager::new();
524524
// Alice receives a non-delta html-message
525-
// (`ShowEmails=AcceptedContacts` lets Alice actually receive non-delta messages for known
525+
// (`ShowEmails=All` lets Alice actually receive non-delta messages for known
526526
// contacts, the contact is marked as known by creating a chat using `chat_with_contact()`)
527527
let alice = &tcm.alice().await;
528528
alice

src/imap.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,7 +2243,7 @@ pub(crate) async fn prefetch_should_download(
22432243
Some(f) => f,
22442244
None => return Ok(false),
22452245
};
2246-
let (_from_id, blocked_contact, origin) =
2246+
let (_from_id, blocked_contact, _origin) =
22472247
match from_field_to_contact_id(context, &from, true).await? {
22482248
Some(res) => res,
22492249
None => return Ok(false),
@@ -2257,7 +2257,6 @@ pub(crate) async fn prefetch_should_download(
22572257
}
22582258

22592259
let is_chat_message = headers.get_header_value(HeaderDef::ChatVersion).is_some();
2260-
let accepted_contact = origin.is_known();
22612260
let is_reply_to_chat_message = get_prefetch_parent_message(context, headers)
22622261
.await?
22632262
.map(|parent| match parent.is_dc_message {
@@ -2272,10 +2271,7 @@ pub(crate) async fn prefetch_should_download(
22722271
let show = is_autocrypt_setup_message
22732272
|| match show_emails {
22742273
ShowEmails::Off => is_chat_message || is_reply_to_chat_message,
2275-
ShowEmails::AcceptedContacts => {
2276-
is_chat_message || is_reply_to_chat_message || accepted_contact
2277-
}
2278-
ShowEmails::All => true,
2274+
ShowEmails::All | ShowEmails::All1 => true,
22792275
};
22802276

22812277
let should_download = (show && !blocked_contact) || maybe_ndn;

src/receive_imf.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,8 +775,7 @@ async fn add_parts(
775775
chat_id = Some(DC_CHAT_ID_TRASH);
776776
allow_creation = false;
777777
}
778-
ShowEmails::AcceptedContacts => allow_creation = false,
779-
ShowEmails::All => allow_creation = !is_mdn,
778+
ShowEmails::All | ShowEmails::All1 => allow_creation = !is_mdn,
780779
}
781780
} else {
782781
allow_creation = !is_mdn && !is_reaction;

src/receive_imf/receive_imf_tests.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,8 @@ async fn test_adhoc_group_outgoing_show_accepted_contact_unaccepted() -> Result<
113113
let mut tcm = TestContextManager::new();
114114
let alice = &tcm.alice().await;
115115
let bob = &tcm.bob().await;
116-
bob.set_config(
117-
Config::ShowEmails,
118-
Some(&ShowEmails::AcceptedContacts.to_string()),
119-
)
120-
.await?;
116+
bob.set_config(Config::ShowEmails, Some(&ShowEmails::All.to_string()))
117+
.await?;
121118
tcm.send_recv(alice, bob, "hi").await;
122119
receive_imf(
123120
bob,

0 commit comments

Comments
 (0)