Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deltachat-ffi/deltachat.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ char* dc_get_blobdir (const dc_context_t* context);
* 0 = Everybody (except explicitly blocked contacts),
* 1 = Contacts (default, does not include contact requests),
* 2 = Nobody (calls never result in a notification).
* - `force_encryption` = 1 (default) to force encryption, 0 to allow unencrypted messages.
*
* Also, there are configs that are only needed
* if you want to use the deprecated dc_configure() API, such as:
Expand Down
1 change: 1 addition & 0 deletions deltachat-rpc-client/tests/test_chatlist_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def test_delivery_status_failed(acfactory: ACFactory) -> None:
Test change status on chatlistitem when status changes failed
"""
(alice,) = acfactory.get_online_accounts(1)
alice.set_config("force_encryption", "0")

invalid_contact = alice.create_contact("example@example.com", "invalid address")
invalid_chat = alice.get_chat_by_id(alice._rpc.create_chat_by_contact_id(alice.id, invalid_contact.id))
Expand Down
5 changes: 0 additions & 5 deletions python/tests/test_3_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,6 @@ def test_send_lots_of_offline_msgs(self, acfactory):
for i in range(50):
chat.send_text("hello")

def test_create_chat_simple(self, acfactory):
ac1 = acfactory.get_pseudo_configured_account()
contact1 = ac1.create_contact("some1@example.org", name="some1")
contact1.create_chat().send_text("hello")

def test_chat_message_distinctions(self, ac1, chat1):
past1s = datetime.now(timezone.utc) - timedelta(seconds=1)
msg = chat1.send_text("msg1")
Expand Down
58 changes: 32 additions & 26 deletions src/calls/calls_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::config::Config;
use crate::constants::DC_CHAT_ID_TRASH;
use crate::message::MessageState;
use crate::receive_imf::receive_imf;
use crate::test_utils;
use crate::test_utils::{TestContext, TestContextManager};

struct CallSetup {
Expand Down Expand Up @@ -634,20 +635,23 @@ async fn test_forward_call() -> Result<()> {
async fn test_end_text_call() -> Result<()> {
let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await;
let bob = &tcm.bob().await;

let received1 = receive_imf(
alice,
b"From: bob@example.net\n\
To: alice@example.org\n\
Message-ID: <first@example.net>\n\
Date: Sun, 22 Mar 2020 22:37:57 +0000\n\
Chat-Version: 1.0\n\
\n\
Hello\n",
false,
let encrypted_message = test_utils::encrypt_raw_message(
bob,
&[alice],
b"From: bob@example.net\r\n\
To: alice@example.org\r\n\
Message-ID: <first@example.net>\r\n\
Date: Sun, 22 Mar 2020 22:37:57 +0000\r\n\
Chat-Version: 1.0\r\n\
\r\n\
Hello\r\n",
)
.await?
.unwrap();
.await?;
let received1 = receive_imf(alice, encrypted_message.as_bytes(), false)
.await?
.unwrap();
assert_eq!(received1.msg_ids.len(), 1);
let msg = Message::load_from_db(alice, received1.msg_ids[0])
.await
Expand All @@ -656,21 +660,23 @@ async fn test_end_text_call() -> Result<()> {

// Receiving "Call ended" message that refers
// to the text message does not result in an error.
let received2 = receive_imf(
alice,
b"From: bob@example.net\n\
To: alice@example.org\n\
Message-ID: <second@example.net>\n\
Date: Sun, 22 Mar 2020 23:37:57 +0000\n\
In-Reply-To: <first@example.net>\n\
Chat-Version: 1.0\n\
Chat-Content: call-ended\n\
\n\
Call ended\n",
false,
let encrypted_message2 = test_utils::encrypt_raw_message(
bob,
&[alice],
b"From: bob@example.net\r\n\
To: alice@example.org\r\n\
Message-ID: <second@example.net>\r\n\
Date: Sun, 22 Mar 2020 23:37:57 +0000\r\n\
In-Reply-To: <first@example.net>\r\n\
Chat-Version: 1.0\r\n\
Chat-Content: call-ended\r\n\
\r\n\
Call ended\r\n",
)
.await?
.unwrap();
.await?;
let received2 = receive_imf(alice, encrypted_message2.as_bytes(), false)
.await?
.unwrap();
assert_eq!(received2.msg_ids.len(), 1);
assert_eq!(received2.chat_id, DC_CHAT_ID_TRASH);

Expand Down
7 changes: 6 additions & 1 deletion src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2823,7 +2823,12 @@ pub(crate) async fn create_send_msg_jobs(context: &Context, msg: &mut Message) -
.await?;
}

let needs_encryption = msg.param.get_bool(Param::GuaranteeE2ee).unwrap_or_default();
let needs_encryption = msg.param.get_bool(Param::GuaranteeE2ee).unwrap_or_default()
|| (!msg
.param
.get_bool(Param::ForcePlaintext)
.unwrap_or_default()
&& context.get_config_bool(Config::ForceEncryption).await?);
let mimefactory = match MimeFactory::from_msg(context, msg.clone()).await {
Ok(mf) => mf,
Err(err) => {
Expand Down
Loading
Loading