directory: implementation draft

This commit is contained in:
Evgeny @ SimpleX Chat committed 2026-08-02 11:14:57 +00:00
1 parent db0d6e2951
commit db1edeebbd
12 files changed
+1000 -407

No files matched your search

+1 -1
View File
@@ -4371,7 +4371,7 @@ processChatCommand cxt nm = \case
linkDomain_ = linkProfile_ >>= \Profile {contactDomain} -> claimDomain <$> contactDomain
planDomain = case nl of CTName ni -> Just (nameDomain ni); _ -> Nothing
refreshContact ct' = case (planDomain, linkProfile_) of
(Just _, Just p) -> updateContactFromLinkData user ct' p
(Just _, Just p) -> fst <$> updateContactFromLinkData user ct' p
_ -> pure ct'
forM_ planDomain $ \nameDomain ->
unless (linkDomain_ == Just nameDomain) $ throwChatError $ CESimplexDomainNotReady nameDomain SDEUnknownDomain
+16 -3
View File
@@ -1520,19 +1520,32 @@ updateGroupFromLinkData user gInfo@GroupInfo {groupProfile = p, groupSummary = G
newClaim = groupClaim groupProfile
verifyResolved = isJust resolvedDomain_ && resolvedDomain_ == newClaim
updateContactFromLinkData :: User -> Contact -> Profile -> CM Contact
updateContactFromLinkData :: User -> Contact -> Profile -> CM (Contact, Bool)
updateContactFromLinkData user ct@Contact {profile = profile@LocalProfile {contactDomain = prevClaim, contactDomainVerified}} linkProfile@Profile {contactDomain = newClaim}
| profileChanged || verifyChanged = do
cxt <- chatStoreCxt
withFastStore $ \db -> do
ct' <- withFastStore $ \db -> do
ct' <- updateContactProfile db cxt user ct linkProfile
if verifyChanged then liftIO $ setContactDomainVerified db user ct' True else pure ct'
| otherwise = pure ct
pure (ct', profileChanged)
| otherwise = pure (ct, False)
where
profileChanged = fromLocalProfile profile /= linkProfile
claimChanged = (claimDomain <$> prevClaim) /= (claimDomain <$> newClaim)
verifyChanged = contactDomainVerified /= Just True || claimChanged
updateKnownContactFromLink :: User -> Contact -> CM (Contact, Bool)
updateKnownContactFromLink user ct@Contact {profile = LocalProfile {contactLink}} =
case contactLink of
Just (CLShort sl) -> do
(_, cData) <- getShortLinkConnReq' NRMBackground user sl
liftIO (decodeLinkUserData cData) >>= \case
Just csld -> do
ContactShortLinkData {profile = linkProfile} <- linkDataBadge csld
updateContactFromLinkData user ct linkProfile
Nothing -> pure (ct, False)
_ -> pure (ct, False)
-- TODO [relays] owner: set owners on updating link data (multi-owner)
groupLinkData :: GroupInfo -> GroupLink -> [GroupRelay] -> (UserConnLinkData 'CMContact, CRClientData)
groupLinkData gInfo@GroupInfo {groupProfile, groupSummary = GroupSummary {publicMemberCount}, membership = GroupMember {memberId}, groupKeys} GroupLink {groupLinkId} groupRelays =