Skip to content

Commit b9aa5e4

Browse files
committed
fix: allow empty To field for self-sent messages
Currently Delta Chat puts self address in the To field to avoid the To field being empty. There is a plan to put empty `hidden-recipients` group there, this fix prepares the receiver for such messages.
1 parent 46aef4f commit b9aa5e4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: src/receive_imf.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,11 @@ async fn add_parts(
10391039
state = MessageState::OutDelivered;
10401040
to_id = to_ids.first().copied().unwrap_or_default();
10411041

1042-
let self_sent = to_ids.len() == 1 && to_ids.contains(&ContactId::SELF);
1042+
// Older Delta Chat versions with core <=1.152.2 send messages to Saved Messages
1043+
// with own address in the `To` field.
1044+
// New Delta Chat versions will use empty `To` field
1045+
// with only a single `hidden-recpipents` group in this case.
1046+
let self_sent = to_ids.is_empty() || (to_ids.len() == 1 && to_id == ContactId::SELF);
10431047

10441048
if mime_parser.sync_items.is_some() && self_sent {
10451049
chat_id = Some(DC_CHAT_ID_TRASH);

0 commit comments

Comments
 (0)