From 6c04184a9c40b9b1b88d474db67206d4cd597c83 Mon Sep 17 00:00:00 2001 From: IanRDavies Date: Sat, 12 Mar 2022 20:57:11 +0000 Subject: [PATCH] core: filter contacts on connection status before broadcasting profile updates (#430) * filter contacts on connection status before broadcasting profile updates * catch and report errors when notifying contacts about profile updates Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> --- src/Simplex/Chat.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Simplex/Chat.hs b/src/Simplex/Chat.hs index d9bcd94167..07ed69e933 100644 --- a/src/Simplex/Chat.hs +++ b/src/Simplex/Chat.hs @@ -448,7 +448,10 @@ processChatCommand = \case asks currentUser >>= atomically . (`writeTVar` Just user') contacts <- withStore (`getUserContacts` user) withChatLock . procCmd $ do - forM_ contacts $ \ct -> sendDirectContactMessage ct $ XInfo p' + forM_ contacts $ \ct -> + let s = connStatus $ activeConn (ct :: Contact) + in when (s == ConnReady || s == ConnSndReady) $ + void (sendDirectContactMessage ct $ XInfo p') `catchError` (toView . CRChatError) pure $ CRUserProfileUpdated p p' getRcvFilePath :: Int64 -> Maybe FilePath -> String -> m FilePath getRcvFilePath fileId filePath fileName = case filePath of