From 44ef9dffb856de2726fb2bc5bf1dd9f233428d2e Mon Sep 17 00:00:00 2001 From: Schmiddiii Date: Sun, 17 Mar 2024 14:16:45 +0100 Subject: [PATCH] Workaround UUID not found errors 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 #110. --- presage/src/manager/registered.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/presage/src/manager/registered.rs b/presage/src/manager/registered.rs index 1f5b3d9c8..31e67449f 100644 --- a/presage/src/manager/registered.rs +++ b/presage/src/manager/registered.rs @@ -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::{ @@ -962,7 +962,12 @@ impl Manager { .await; // return first error if any - results.into_iter().find(|res| res.is_err()).transpose()?; + // Ignore any NotFound errors, those mean that e.g. some contact in a group deleted his account. + // 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 him anymore. + results + .into_iter() + .find(|res| res.is_err() && !matches!(res, Err(MessageSenderError::NotFound { .. }))) + .transpose()?; let content = Content { metadata: Metadata {