Skip to content

Commit

Permalink
Workaround UUID not found errors (whisperfish#243)
Browse files Browse the repository at this point in the history
This just ignores those errors when sending to a group.

Ideally, this should mark such contacts as unregistered and not send
messages to them anymore. But the store does not yet have the capability
to do that.

Related to whisperfish#110.
---------

Co-authored-by: Gabriel Féron <[email protected]>
  • Loading branch information
Schmiddiii and gferon authored Mar 17, 2024
1 parent 97e2357 commit 910d2c3
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions presage/src/manager/registered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use libsignal_service::groups_v2::{decrypt_group, Group, GroupsManager, InMemory
use libsignal_service::messagepipe::{Incoming, MessagePipe, ServiceCredentials};
use libsignal_service::models::Contact;
use libsignal_service::prelude::phonenumber::PhoneNumber;
use libsignal_service::prelude::{ProtobufMessage, Uuid};
use libsignal_service::prelude::{MessageSenderError, ProtobufMessage, Uuid};
use libsignal_service::profile_cipher::ProfileCipher;
use libsignal_service::proto::data_message::Delete;
use libsignal_service::proto::{
Expand Down Expand Up @@ -961,8 +961,20 @@ impl<S: Store> Manager<S, Registered> {
.send_message_to_group(recipients, content_body.clone(), timestamp, online_only)
.await;

// return first error if any
results.into_iter().find(|res| res.is_err()).transpose()?;
// TODO: Handle the NotFound error in the future by removing all sessions to this UUID and marking it as unregistered, not sending any messages to this contact anymore.
results
.into_iter()
.find(|res| match res {
Ok(_) => false,
// Ignore any NotFound errors, those mean that e.g. some contact in a group deleted his account.
Err(MessageSenderError::NotFound { uuid }) => {
debug!("UUID {uuid} not found, skipping sent message result");
false
}
// return first error if any
Err(_) => true,
})
.transpose()?;

let content = Content {
metadata: Metadata {
Expand Down

0 comments on commit 910d2c3

Please sign in to comment.