Skip to content
Merged
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
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@ This reverts commit 6f22ce2722b51773d7fbb0d89e4764f963cafd91..
### Fixes

- Reset quota on configured address change ([#5908](https://github.com/chatmail/core/pull/5908)).
- Do not emit progress 1000 when configuration is cancelled.
- Do not emit progress 1000 when configuration is canceled.
- Assume file extensions are 32 chars max and don't contain whitespace ([#5338](https://github.com/chatmail/core/pull/5338)).
- Re-add tokens.foreign_id column ([#6038](https://github.com/chatmail/core/pull/6038)).

Expand Down Expand Up @@ -4212,7 +4212,7 @@ Bugfix release attempting to fix the [iOS build error](https://github.com/chatma
- Recreate `smtp` table with AUTOINCREMENT `id` ([#4390](https://github.com/chatmail/core/pull/4390)).
- Do not return an error from `send_msg_to_smtp` if retry limit is exceeded.
- Make the bots automatically accept group chat contact requests ([#4377](https://github.com/chatmail/core/pull/4377)).
- Delete `smtp` rows when message sending is cancelled ([#4391](https://github.com/chatmail/core/pull/4391)).
- Delete `smtp` rows when message sending is canceled ([#4391](https://github.com/chatmail/core/pull/4391)).

### Refactor

Expand All @@ -4223,7 +4223,7 @@ Bugfix release attempting to fix the [iOS build error](https://github.com/chatma
### Fixes

- Fetch at most 100 existing messages even if EXISTS was not received.
- Delete `smtp` rows when message sending is cancelled.
- Delete `smtp` rows when message sending is canceled.

### Changes

Expand Down Expand Up @@ -4310,14 +4310,14 @@ Bugfix release attempting to fix the [iOS build error](https://github.com/chatma
## [1.112.3] - 2023-03-30

### Fixes
- `transfer::get_backup` now frees ongoing process when cancelled. #4249
- `transfer::get_backup` now frees ongoing process when canceled. #4249

## [1.112.2] - 2023-03-30

### Changes
- Update iroh, remove `default-net` from `[patch.crates-io]` section.
- transfer backup: Connect to multiple provider addresses concurrently. This should speed up connection time significantly on the getter side. #4240
- Make sure BackupProvider is cancelled on drop (or `dc_backup_provider_unref`). The BackupProvider will now always finish with an IMEX event of 1000 or 0, previously it would sometimes finished with 1000 (success) when it really was 0 (failure). #4242
- Make sure BackupProvider is canceled on drop (or `dc_backup_provider_unref`). The BackupProvider will now always finish with an IMEX event of 1000 or 0, previously it would sometimes finished with 1000 (success) when it really was 0 (failure). #4242

### Fixes
- Do not return media from trashed messages in the "All media" view. #4247
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ If you want to contribute a code, follow this guide.

The following prefix types are used:
- `feat`: Features, e.g. "feat: Pause IO for BackupProvider". If you are unsure what's the category of your commit, you can often just use `feat`.
- `fix`: Bug fixes, e.g. "fix: delete `smtp` rows when message sending is cancelled"
- `fix`: Bug fixes, e.g. "fix: delete `smtp` rows when message sending is canceled"
- `api`: API changes, e.g. "api(rust): add `get_msg_read_receipts(context, msg_id)`"
- `refactor`: Refactorings, e.g. "refactor: iterate over `msg_ids` without `.iter()`"
- `perf`: Performance improvements, e.g. "perf: improve SQLite performance with `PRAGMA synchronous=normal`"
Expand Down
19 changes: 17 additions & 2 deletions deltachat-ffi/deltachat.h
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ uint32_t dc_init_webxdc_integration (dc_context_t* context, uint32_t c
*
* - callee declines using dc_end_call():
* caller receives #DC_EVENT_CALL_ENDED and has a "Declinced Call".
* callee's other devices receive #DC_EVENT_CALL_ENDED and have a "Cancelled Call",
* callee's other devices receive #DC_EVENT_CALL_ENDED and have a "Canceled Call",
*
* - callee is already in a call:
* in this case, UI may decide to show a notification instead of ringing.
Expand All @@ -1241,7 +1241,7 @@ uint32_t dc_init_webxdc_integration (dc_context_t* context, uint32_t c
* caller and callee receive #DC_EVENT_CALL_ENDED
* to prevent endless ringing of callee
* in case caller got offline without being able to send cancellation message.
* for caller, this is a "Cancelled Call";
* for caller, this is a "Canceled Call";
* for callee, this is a "Missed Call"
*
* Actions during the call:
Expand Down Expand Up @@ -7820,6 +7820,21 @@ void dc_event_unref(dc_event_t* event);
/// "❤️ Seems you're enjoying Delta Chat!"… (donation request device message)
#define DC_STR_DONATION_REQUEST 193

/// "Outgoing Call"
#define DC_STR_OUTGOING_CALL 194

/// "Incoming Call"
#define DC_STR_INCOMING_CALL 195

/// "Declined Call"
#define DC_STR_DECLINED_CALL 196

/// "Canceled Call"
#define DC_STR_CANCELED_CALL 197

/// "Missed Call"
#define DC_STR_MISSED_CALL 198

/// "Contact". Deprecated, currently unused.
#define DC_STR_CONTACT 200

Expand Down
6 changes: 3 additions & 3 deletions deltachat-jsonrpc/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1809,13 +1809,13 @@ impl CommandApi {

/// Offers a backup for remote devices to retrieve.
///
/// Can be cancelled by stopping the ongoing process. Success or failure can be tracked
/// Can be canceled by stopping the ongoing process. Success or failure can be tracked
/// via the `ImexProgress` event which should either reach `1000` for success or `0` for
/// failure.
///
/// This **stops IO** while it is running.
///
/// Returns once a remote device has retrieved the backup, or is cancelled.
/// Returns once a remote device has retrieved the backup, or is canceled.
async fn provide_backup(&self, account_id: u32) -> Result<()> {
let ctx = self.get_context(account_id).await?;

Expand Down Expand Up @@ -1881,7 +1881,7 @@ impl CommandApi {
/// This retrieves the backup from a remote device over the network and imports it into
/// the current device.
///
/// Can be cancelled by stopping the ongoing process.
/// Can be canceled by stopping the ongoing process.
///
/// Do not forget to call start_io on the account after a successful import,
/// otherwise it will not connect to the email server.
Expand Down
12 changes: 6 additions & 6 deletions deltachat-jsonrpc/src/api/types/calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct JsonrpcCallInfo {

/// Call state.
///
/// For example, if the call is accepted, active, cancelled, declined etc.
/// For example, if the call is accepted, active, canceled, declined etc.
pub state: JsonrpcCallState,
}

Expand Down Expand Up @@ -68,13 +68,13 @@ pub enum JsonrpcCallState {
/// that was declined before the timeout.
Declined,

/// Outgoing call that has been cancelled on our side
/// Outgoing call that has been canceled on our side
/// before receiving a response.
///
/// Incoming calls cannot be cancelled,
/// on the receiver side cancelled calls
/// Incoming calls cannot be canceled,
/// on the receiver side canceled calls
/// usually result in missed calls.
Cancelled,
Canceled,
}

impl JsonrpcCallState {
Expand All @@ -87,7 +87,7 @@ impl JsonrpcCallState {
CallState::Completed { duration } => JsonrpcCallState::Completed { duration },
CallState::Missed => JsonrpcCallState::Missed,
CallState::Declined => JsonrpcCallState::Declined,
CallState::Cancelled => JsonrpcCallState::Cancelled,
CallState::Canceled => JsonrpcCallState::Canceled,
};

Ok(jsonrpc_call_state)
Expand Down
46 changes: 23 additions & 23 deletions src/calls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ const STUN_PORT: u16 = 3478;
///
/// It is used to distinguish "ended" calls
/// that are rejected by us from the calls
/// cancelled by the other side
/// canceled by the other side
/// immediately after ringing started.
const CALL_CANCELLED_TIMESTAMP: Param = Param::Arg2;
const CALL_CANCELED_TIMESTAMP: Param = Param::Arg2;

/// Information about the status of a call.
#[derive(Debug, Default)]
Expand Down Expand Up @@ -123,14 +123,14 @@ impl CallInfo {
}

/// Returns true if the call is missed
/// because the caller cancelled it
/// because the caller canceled it
/// explicitly before ringing stopped.
///
/// For outgoing calls this means
/// the receiver has rejected the call
/// explicitly.
pub fn is_cancelled(&self) -> bool {
self.msg.param.exists(CALL_CANCELLED_TIMESTAMP)
pub fn is_canceled(&self) -> bool {
self.msg.param.exists(CALL_CANCELED_TIMESTAMP)
}

async fn mark_as_ended(&mut self, context: &Context) -> Result<()> {
Expand All @@ -139,17 +139,17 @@ impl CallInfo {
Ok(())
}

/// Explicitly mark the call as cancelled.
/// Explicitly mark the call as canceled.
///
/// For incoming calls this should be called
/// when "call ended" message is received
/// from the caller before we picked up the call.
/// In this case the call becomes "missed" early
/// before the ringing timeout.
async fn mark_as_cancelled(&mut self, context: &Context) -> Result<()> {
async fn mark_as_canceled(&mut self, context: &Context) -> Result<()> {
let now = time();
self.msg.param.set_i64(CALL_ENDED_TIMESTAMP, now);
self.msg.param.set_i64(CALL_CANCELLED_TIMESTAMP, now);
self.msg.param.set_i64(CALL_CANCELED_TIMESTAMP, now);
self.msg.update_param(context).await?;
Ok(())
}
Expand Down Expand Up @@ -255,8 +255,8 @@ impl Context {
call.mark_as_ended(self).await?;
call.update_text(self, "Declined call").await?;
} else {
call.mark_as_cancelled(self).await?;
call.update_text(self, "Cancelled call").await?;
call.mark_as_canceled(self).await?;
call.update_text(self, "Canceled call").await?;
}
} else {
call.mark_as_ended(self).await?;
Expand Down Expand Up @@ -290,11 +290,11 @@ impl Context {
let mut call = context.load_call_by_id(call_id).await?;
if !call.is_accepted() && !call.is_ended() {
if call.is_incoming() {
call.mark_as_cancelled(&context).await?;
call.mark_as_canceled(&context).await?;
call.update_text(&context, "Missed call").await?;
} else {
call.mark_as_ended(&context).await?;
call.update_text(&context, "Cancelled call").await?;
call.update_text(&context, "Canceled call").await?;
}
context.emit_msgs_changed(call.msg.chat_id, call_id);
context.emit_event(EventType::CallEnded {
Expand Down Expand Up @@ -386,14 +386,14 @@ impl Context {
call.mark_as_ended(self).await?;
call.update_text(self, "Declined call").await?;
} else {
call.mark_as_cancelled(self).await?;
call.mark_as_canceled(self).await?;
call.update_text(self, "Missed call").await?;
}
} else {
// outgoing
if from_id == ContactId::SELF {
call.mark_as_cancelled(self).await?;
call.update_text(self, "Cancelled call").await?;
call.mark_as_canceled(self).await?;
call.update_text(self, "Canceled call").await?;
} else {
call.mark_as_ended(self).await?;
call.update_text(self, "Declined call").await?;
Expand Down Expand Up @@ -483,13 +483,13 @@ pub enum CallState {
/// that was declined before the timeout.
Declined,

/// Outgoing call that has been cancelled on our side
/// Outgoing call that has been canceled on our side
/// before receiving a response.
///
/// Incoming calls cannot be cancelled,
/// on the receiver side cancelled calls
/// Incoming calls cannot be canceled,
/// on the receiver side canceled calls
/// usually result in missed calls.
Cancelled,
Canceled,
}

/// Returns call state given the message ID.
Expand All @@ -504,8 +504,8 @@ pub async fn call_state(context: &Context, msg_id: MsgId) -> Result<CallState> {
} else {
CallState::Active
}
} else if call.is_cancelled() {
// Call was explicitly cancelled
} else if call.is_canceled() {
// Call was explicitly canceled
// by the caller before we picked it up.
CallState::Missed
} else if call.is_ended() {
Expand All @@ -523,8 +523,8 @@ pub async fn call_state(context: &Context, msg_id: MsgId) -> Result<CallState> {
} else {
CallState::Active
}
} else if call.is_cancelled() {
CallState::Cancelled
} else if call.is_canceled() {
CallState::Canceled
} else if call.is_ended() || call.is_stale() {
CallState::Declined
} else {
Expand Down
13 changes: 9 additions & 4 deletions src/calls/calls_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,26 +368,26 @@ async fn test_caller_cancels_call() -> Result<()> {

// Alice changes their mind before Bob picks up
alice.end_call(alice_call.id).await?;
assert_text(&alice, alice_call.id, "Cancelled call").await?;
assert_text(&alice, alice_call.id, "Canceled call").await?;
alice
.evtracker
.get_matching(|evt| matches!(evt, EventType::CallEnded { .. }))
.await;
let sent3 = alice.pop_sent_msg().await;
assert_eq!(
call_state(&alice, alice_call.id).await?,
CallState::Cancelled
CallState::Canceled
);

alice2.recv_msg_trash(&sent3).await;
assert_text(&alice2, alice2_call.id, "Cancelled call").await?;
assert_text(&alice2, alice2_call.id, "Canceled call").await?;
alice2
.evtracker
.get_matching(|evt| matches!(evt, EventType::CallEnded { .. }))
.await;
assert_eq!(
call_state(&alice2, alice2_call.id).await?,
CallState::Cancelled
CallState::Canceled
);

// Bob receives the ending message
Expand All @@ -398,6 +398,11 @@ async fn test_caller_cancels_call() -> Result<()> {
.await;
assert_eq!(call_state(&bob, bob_call.id).await?, CallState::Missed);

// Test that message summary says it is a missed call.
let bob_call_msg = Message::load_from_db(&bob, bob_call.id).await?;
let summary = bob_call_msg.get_summary(&bob, None).await?;
assert_eq!(summary.text, "📞 Missed Call");

bob2.recv_msg_trash(&sent3).await;
assert_text(&bob2, bob2_call.id, "Missed call").await?;
bob2.evtracker
Expand Down
2 changes: 1 addition & 1 deletion src/configure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl Context {

let res = self
.inner_configure(param)
.race(cancel_channel.recv().map(|_| Err(format_err!("Cancelled"))))
.race(cancel_channel.recv().map(|_| Err(format_err!("Canceled"))))
.await;

self.free_ongoing().await;
Expand Down
8 changes: 4 additions & 4 deletions src/imex/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ impl BackupProvider {
if let Err(err) = Self::handle_connection(context.clone(), conn, auth_token, dbfile).race(
async {
cancel_token.recv().await.ok();
Err(format_err!("Backup transfer cancelled"))
Err(format_err!("Backup transfer canceled"))
}
).race(
async {
Expand All @@ -262,12 +262,12 @@ impl BackupProvider {
}
},
_ = cancel_token.recv() => {
info!(context, "Backup transfer cancelled by the user, stopping accept loop.");
info!(context, "Backup transfer canceled by the user, stopping accept loop.");
context.emit_event(EventType::ImexProgress(0));
break;
}
_ = drop_token.cancelled() => {
info!(context, "Backup transfer cancelled by dropping the provider, stopping accept loop.");
info!(context, "Backup transfer canceled by dropping the provider, stopping accept loop.");
context.emit_event(EventType::ImexProgress(0));
break;
}
Expand Down Expand Up @@ -364,7 +364,7 @@ pub async fn get_backup(context: &Context, qr: Qr) -> Result<()> {
let res = get_backup2(context, node_addr, auth_token)
.race(async {
cancel_token.recv().await.ok();
Err(format_err!("Backup reception cancelled"))
Err(format_err!("Backup reception canceled"))
})
.await;
if let Err(ref res) = res {
Expand Down
Loading