Skip to content

Commit d26a274

Browse files
committed
fix: default to_id to self instead of 0
If message has empty `To` field it is a self-sent message like a message in Saved Messages chat or a sync message.
1 parent ed2a3a7 commit d26a274

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/receive_imf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ pub(crate) async fn receive_imf_inner(
360360
let contact = Contact::get_by_id(context, from_id).await?;
361361
mime_parser.peerstate = Peerstate::from_addr(context, contact.get_addr()).await?;
362362
} else {
363-
let to_id = to_ids.first().copied().unwrap_or_default();
363+
let to_id = to_ids.first().copied().unwrap_or(ContactId::SELF);
364364
// handshake may mark contacts as verified and must be processed before chats are created
365365
res = observe_securejoin_on_other_device(context, &mime_parser, to_id)
366366
.await
@@ -1037,7 +1037,7 @@ async fn add_parts(
10371037
// the mail is on the IMAP server, probably it is also delivered.
10381038
// We cannot recreate other states (read, error).
10391039
state = MessageState::OutDelivered;
1040-
to_id = to_ids.first().copied().unwrap_or_default();
1040+
to_id = to_ids.first().copied().unwrap_or(ContactId::SELF);
10411041

10421042
// Older Delta Chat versions with core <=1.152.2 only accepted
10431043
// self-sent messages in Saved Messages with own address in the `To` field.

0 commit comments

Comments
 (0)