more renames

This commit is contained in:
Evgeny Poberezkin
2026-06-30 17:42:40 +01:00
parent 569de5cd06
commit 86bbe62a28
23 changed files with 81 additions and 80 deletions
@@ -395,7 +395,7 @@ struct ChatInfoView: View {
if let claim = contact.profile.simplexName, claim.proof != nil {
SimplexNameView(
name: claim.shortName,
verification: contact.profile.contactNameVerification,
verification: contact.profile.simplexNameVerification,
autoVerify: UserDefaults.standard.bool(forKey: DEFAULT_PRIVACY_VERIFY_SIMPLEX_NAMES),
verify: {
do {
@@ -404,7 +404,7 @@ struct ChatInfoView: View {
chatModel.updateContact(ct)
contact = ct
}
return (ct.profile.contactNameVerification, reason)
return (ct.profile.simplexNameVerification, reason)
} catch {
logger.error("apiVerifyContactName: \(responseError(error))")
return nil
@@ -149,7 +149,7 @@ struct ChannelWebAccessView: View {
pg.publicGroupAccess = PublicGroupAccess(
groupWebPage: trimmedPage.isEmpty ? nil : trimmedPage,
simplexName: existingAccess?.simplexName,
domainWebPage: existingAccess?.domainWebPage ?? false,
simplexNameWebPage: existingAccess?.simplexNameWebPage ?? false,
allowEmbedding: allowEmbedding
)
gp.publicGroup = pg
@@ -362,7 +362,7 @@ struct GroupChatInfoView: View {
access.simplexName?.proof != nil {
SimplexNameView(
name: groupName,
verification: groupInfo.groupNameVerification,
verification: groupInfo.simplexNameVerification,
autoVerify: UserDefaults.standard.bool(forKey: DEFAULT_PRIVACY_VERIFY_SIMPLEX_NAMES),
verify: {
do {
@@ -371,7 +371,7 @@ struct GroupChatInfoView: View {
chatModel.updateGroup(gInfo)
groupInfo = gInfo
}
return (gInfo.groupNameVerification, reason)
return (gInfo.simplexNameVerification, reason)
} catch {
logger.error("apiVerifyPublicGroupName: \(responseError(error))")
return nil
+7 -7
View File
@@ -163,7 +163,7 @@ public struct LocalProfile: Codable, NamedChat, Hashable {
localBadge: LocalBadge? = nil,
localAlias: String,
simplexName: SimplexNameClaim? = nil,
contactNameVerification: Bool? = nil
simplexNameVerification: Bool? = nil
) {
self.profileId = profileId
self.displayName = displayName
@@ -176,7 +176,7 @@ public struct LocalProfile: Codable, NamedChat, Hashable {
self.localBadge = localBadge
self.localAlias = localAlias
self.simplexName = simplexName
self.contactNameVerification = contactNameVerification
self.simplexNameVerification = simplexNameVerification
}
public var profileId: Int64
@@ -190,7 +190,7 @@ public struct LocalProfile: Codable, NamedChat, Hashable {
public var localBadge: LocalBadge?
public var localAlias: String
public var simplexName: SimplexNameClaim?
public var contactNameVerification: Bool?
public var simplexNameVerification: Bool?
var profileViewName: String {
localAlias == ""
@@ -2540,7 +2540,7 @@ public struct GroupInfo: Identifiable, Decodable, NamedChat, Hashable {
public var chatTags: [Int64]
public var chatItemTTL: Int64?
public var localAlias: String
public var groupNameVerification: Bool?
public var simplexNameVerification: Bool?
public var isOwner: Bool {
return membership.memberRole == .owner && membership.memberCurrent
@@ -2621,16 +2621,16 @@ public enum GroupType: Codable, Hashable {
}
public struct PublicGroupAccess: Codable, Hashable {
public init(groupWebPage: String? = nil, simplexName: SimplexNameClaim? = nil, domainWebPage: Bool = false, allowEmbedding: Bool = false) {
public init(groupWebPage: String? = nil, simplexName: SimplexNameClaim? = nil, simplexNameWebPage: Bool = false, allowEmbedding: Bool = false) {
self.groupWebPage = groupWebPage
self.simplexName = simplexName
self.domainWebPage = domainWebPage
self.simplexNameWebPage = simplexNameWebPage
self.allowEmbedding = allowEmbedding
}
public var groupWebPage: String?
public var simplexName: SimplexNameClaim?
public var domainWebPage: Bool = false
public var simplexNameWebPage: Bool = false
public var allowEmbedding: Bool = false
}
@@ -2070,7 +2070,7 @@ data class LocalProfile(
val peerType: ChatPeerType? = null,
val localBadge: LocalBadge? = null,
val simplexName: SimplexNameClaim? = null,
val contactNameVerification: Boolean? = null
val simplexNameVerification: Boolean? = null
): NamedChat {
val profileViewName: String = localAlias.ifEmpty { if (fullName == "" || displayName == fullName) displayName else "$displayName ($fullName)" }
@@ -2200,7 +2200,7 @@ data class GroupInfo (
val chatTags: List<Long>,
val chatItemTTL: Long?,
override val localAlias: String,
val groupNameVerification: Boolean? = null,
val simplexNameVerification: Boolean? = null,
): SomeChat, NamedChat {
override val chatType get() = ChatType.Group
override val id get() = "#$groupId"
@@ -2334,7 +2334,7 @@ data class SimplexNameClaim(
data class PublicGroupAccess(
val groupWebPage: String? = null,
val simplexName: SimplexNameClaim? = null,
val domainWebPage: Boolean = false,
val simplexNameWebPage: Boolean = false,
val allowEmbedding: Boolean = false
)
@@ -757,17 +757,17 @@ fun ChatInfoHeader(cInfo: ChatInfo, contact: Contact) {
modifier = Modifier.combinedClickable(onClick = copyDisplayName, onLongClick = copyDisplayName).onRightClick(copyDisplayName)
)
ChatInfoDescription(cInfo, displayName, copyNameToClipboard)
val contactDomain = contact.profile.simplexName?.shortName
if (contactDomain != null && contact.profile.simplexName?.proof != null) {
val simplexName = contact.profile.simplexName?.shortName
if (simplexName != null && contact.profile.simplexName?.proof != null) {
SimplexNameView(
name = contactDomain,
verification = contact.profile.contactNameVerification,
name = simplexName,
verification = contact.profile.simplexNameVerification,
autoVerify = chatModel.controller.appPrefs.privacyVerifySimplexNames.get(),
verify = {
val rhId = chatModel.remoteHostId()
chatModel.controller.apiVerifyContactName(rhId, contact.contactId)?.let { (ct, reason) ->
chatModel.chatsContext.updateContact(rhId, ct)
ct.profile.contactNameVerification to reason
ct.profile.simplexNameVerification to reason
}
}
)
@@ -50,7 +50,7 @@ fun ChannelWebPageView(
val newAccess = PublicGroupAccess(
groupWebPage = trimmedPage.ifEmpty { null },
simplexName = access?.simplexName,
domainWebPage = access?.domainWebPage ?: false,
simplexNameWebPage = access?.simplexNameWebPage ?: false,
allowEmbedding = allowEmbedding.value
)
val gp = groupInfo.groupProfile.copy(
@@ -979,13 +979,13 @@ private fun GroupChatInfoHeader(cInfo: ChatInfo, groupInfo: GroupInfo) {
if (groupName != null && access.simplexName?.proof != null) {
SimplexNameView(
name = groupName,
verification = groupInfo.groupNameVerification,
verification = groupInfo.simplexNameVerification,
autoVerify = chatModel.controller.appPrefs.privacyVerifySimplexNames.get(),
verify = {
val rhId = chatModel.remoteHostId()
chatModel.controller.apiVerifyPublicGroupName(rhId, groupInfo.groupId)?.let { (gInfo, reason) ->
chatModel.chatsContext.updateGroup(rhId, gInfo)
gInfo.groupNameVerification to reason
gInfo.simplexNameVerification to reason
}
}
)
+3 -3
View File
@@ -2365,7 +2365,7 @@ MemberSupport:
- membersRequireAttention: int
- viaGroupLinkUri: string?
- groupKeys: [GroupKeys](#groupkeys)?
- groupDomainVerification: bool?
- simplexNameVerification: bool?
---
@@ -2791,7 +2791,7 @@ Unknown:
- localBadge: [LocalBadge](#localbadge)?
- localAlias: string
- simplexName: [SimplexNameClaim](#simplexnameclaim)?
- contactDomainVerification: bool?
- simplexNameVerification: bool?
---
@@ -3214,7 +3214,7 @@ NO_SESSION:
**Record type**:
- groupWebPage: string?
- simplexName: [SimplexNameClaim](#simplexnameclaim)?
- domainWebPage: bool
- simplexNameWebPage: bool
- allowEmbedding: bool
+1
View File
@@ -410,6 +410,7 @@ undocumentedCommands =
"APISetMemberSettings",
"APISetNetworkConfig",
"APISetNetworkInfo",
"APISetPublicGroupAccess",
"APISetServerOperators",
"APISetUserContactReceipts",
"APISetUserGroupReceipts",
+1 -1
View File
@@ -42,7 +42,7 @@ import Simplex.Chat.Types.Shared
import Simplex.Chat.Types.UITheme
import Simplex.FileTransfer.Transport
import Simplex.FileTransfer.Types hiding (RcvFileStatus) -- the type with the same name is used in simplex-chat.
import Simplex.Messaging.Agent.Protocol hiding (ConnectTarget (..))
import Simplex.Messaging.Agent.Protocol
import Simplex.Messaging.Client
import Simplex.Messaging.Crypto.File
import Simplex.Messaging.Parsers (dropPrefix, fstToLower)
@@ -2651,7 +2651,7 @@ export interface GroupInfo {
membersRequireAttention: number // int
viaGroupLinkUri?: string
groupKeys?: GroupKeys
groupDomainVerification?: boolean
simplexNameVerification?: boolean
}
export interface GroupKeys {
@@ -3030,7 +3030,7 @@ export interface LocalProfile {
localBadge?: LocalBadge
localAlias: string
simplexName?: SimplexNameClaim
contactDomainVerification?: boolean
simplexNameVerification?: boolean
}
export enum MemberCriteria {
@@ -3473,7 +3473,7 @@ export namespace ProxyError {
export interface PublicGroupAccess {
groupWebPage?: string
simplexName?: SimplexNameClaim
domainWebPage: boolean
simplexNameWebPage: boolean
allowEmbedding: boolean
}
@@ -1858,7 +1858,7 @@ class GroupInfo(TypedDict):
membersRequireAttention: int # int
viaGroupLinkUri: NotRequired[str]
groupKeys: NotRequired["GroupKeys"]
groupDomainVerification: NotRequired[bool]
simplexNameVerification: NotRequired[bool]
class GroupKeys(TypedDict):
publicGroupId: str
@@ -2122,7 +2122,7 @@ class LocalProfile(TypedDict):
localBadge: NotRequired["LocalBadge"]
localAlias: str
simplexName: NotRequired["SimplexNameClaim"]
contactDomainVerification: NotRequired[bool]
simplexNameVerification: NotRequired[bool]
MemberCriteria = Literal["all"]
@@ -2436,7 +2436,7 @@ ProxyError_Tag = Literal["PROTOCOL", "BROKER", "BASIC_AUTH", "NO_SESSION"]
class PublicGroupAccess(TypedDict):
groupWebPage: NotRequired[str]
simplexName: NotRequired["SimplexNameClaim"]
domainWebPage: bool
simplexNameWebPage: bool
allowEmbedding: bool
class PublicGroupData(TypedDict):
+3 -3
View File
@@ -5670,10 +5670,10 @@ chatCommandP =
onOffP = ("on" $> True) <|> ("off" $> False)
publicGroupAccessP = do
groupWebPage <- optional (" web=" *> (safeDecodeUtf8 <$> A.takeTill A.isSpace))
groupDomain <- optional (" domain=" *> strP)
domainWebPage <- (" domain_page=" *> onOffP) <|> pure False
simplexName <- optional (" name=" *> strP)
simplexNameWebPage <- (" name_page=" *> onOffP) <|> pure False
allowEmbedding <- (" embed=" *> onOffP) <|> pure False
pure PublicGroupAccess {groupWebPage, simplexName = mkSimplexNameClaim groupDomain Nothing, domainWebPage, allowEmbedding}
pure PublicGroupAccess {groupWebPage, simplexName = mkSimplexNameClaim simplexName Nothing, simplexNameWebPage, allowEmbedding}
profileNameDescr = (,) <$> displayNameP <*> shortDescrP
-- 'Help with bot':'link <ID>','Menu of commands':[...]
botCommandsP :: Parser [ChatBotCommand]
+2 -2
View File
@@ -1468,7 +1468,7 @@ updateGroupFromLinkData user gInfo@GroupInfo {groupProfile = p, groupSummary = G
_ -> False
updateContactFromLinkData :: User -> Contact -> Profile -> CM Contact
updateContactFromLinkData user ct@Contact {contactId, profile = profile@LocalProfile {simplexName = prevClaim, contactNameVerification}} linkProfile@Profile {simplexName = newClaim}
updateContactFromLinkData user ct@Contact {contactId, profile = profile@LocalProfile {simplexName = prevClaim, simplexNameVerification}} linkProfile@Profile {simplexName = newClaim}
| profileChanged || verifyChanged = do
cxt <- chatStoreCxt
when profileChanged $ void $ withStore $ \db -> updateContactProfile db cxt user ct linkProfile
@@ -1478,7 +1478,7 @@ updateContactFromLinkData user ct@Contact {contactId, profile = profile@LocalPro
where
profileChanged = fromLocalProfile profile /= linkProfile
claimChanged = (claimName <$> prevClaim) /= (claimName <$> newClaim)
verifyChanged = contactNameVerification /= Just True || claimChanged
verifyChanged = simplexNameVerification /= Just True || claimChanged
-- TODO [relays] owner: set owners on updating link data (multi-owner)
groupLinkData :: GroupInfo -> GroupLink -> [GroupRelay] -> (UserConnLinkData 'CMContact, CRClientData)
+2 -2
View File
@@ -125,8 +125,8 @@ getConnectionEntity db cxt user@User {userId, userContactId} agentConnId = do
|]
(userId, contactId, CSActive)
toContact' :: UTCTime -> Int64 -> Connection -> [ChatTagId] -> ContactRow' -> Contact
toContact' currentTs contactId conn chatTags ((profileId, localDisplayName, displayName, fullName, shortDescr, image, contactLink, peerType, localAlias, BI contactUsed, contactStatus) :. (enableNtfs_, sendRcpts, BI favorite, preferences, userPreferences, createdAt, updatedAt, chatTs) :. preparedContactRow :. (contactRequestId, contactGroupMemberId, BI contactGrpInvSent) :. groupDirectInvRow :. (uiThemes, BI chatDeleted, customData, chatItemTTL) :. badgeRow :. (cpContactDomain, cpContactNameVerification, cpContactDomainProof)) =
let profile = LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim cpContactDomain cpContactDomainProof, contactNameVerification = unBI <$> cpContactNameVerification, peerType, localBadge = rowToBadge currentTs badgeRow, preferences, localAlias}
toContact' currentTs contactId conn chatTags ((profileId, localDisplayName, displayName, fullName, shortDescr, image, contactLink, peerType, localAlias, BI contactUsed, contactStatus) :. (enableNtfs_, sendRcpts, BI favorite, preferences, userPreferences, createdAt, updatedAt, chatTs) :. preparedContactRow :. (contactRequestId, contactGroupMemberId, BI contactGrpInvSent) :. groupDirectInvRow :. (uiThemes, BI chatDeleted, customData, chatItemTTL) :. badgeRow :. (cpsimplexName, cpContactNameVerification, cpsimplexNameProof)) =
let profile = LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim cpsimplexName cpsimplexNameProof, simplexNameVerification = unBI <$> cpContactNameVerification, peerType, localBadge = rowToBadge currentTs badgeRow, preferences, localAlias}
chatSettings = ChatSettings {enableNtfs = fromMaybe MFAll enableNtfs_, sendRcpts = unBI <$> sendRcpts, favorite}
mergedPreferences = contactUserPreferences user userPreferences preferences $ connIncognito conn
activeConn = Just conn
+1 -1
View File
@@ -569,7 +569,7 @@ updateContactProfile db cxt user@User {userId} c p' = do
profile = toLocalProfile profileId p'' localAlias currentTs badgeVerified nameVerified
updateContactProfile' currentTs badgeVerified profile
where
Contact {contactId, localDisplayName, profile = lp@LocalProfile {profileId, displayName, localAlias, simplexName = prevClaim, contactNameVerification = prevVerification}, userPreferences} = c
Contact {contactId, localDisplayName, profile = lp@LocalProfile {profileId, displayName, localAlias, simplexName = prevClaim, simplexNameVerification = prevVerification}, userPreferences} = c
Profile {displayName = newName, simplexName, preferences} = p'
mergedPreferences = contactUserPreferences user userPreferences preferences $ contactConnIncognito c
claimChanged = (claimName <$> prevClaim) /= (claimName <$> simplexName)
+5 -5
View File
@@ -258,8 +258,8 @@ import Database.SQLite.Simple.QQ (sql)
type MaybeGroupMemberRow = (Maybe GroupMemberId, Maybe GroupId, Maybe Int64, Maybe MemberId, Maybe VersionChat, Maybe VersionChat, Maybe GroupMemberRole, Maybe GroupMemberCategory, Maybe GroupMemberStatus, Maybe BoolInt, Maybe MemberRestrictionStatus) :. (Maybe Int64, Maybe GroupMemberId, Maybe ContactName, Maybe ContactId, Maybe ProfileId) :. ((Maybe ProfileId, Maybe ContactName, Maybe Text, Maybe Text, Maybe ImageData, Maybe ConnLinkContact, Maybe ChatPeerType, Maybe LocalAlias, Maybe Preferences) :. BadgeRow :. (Maybe SimplexNameInfo, Maybe BoolInt, Maybe NameClaimProof)) :. (Maybe UTCTime, Maybe UTCTime) :. (Maybe UTCTime, Maybe Int64, Maybe Int64, Maybe Int64, Maybe UTCTime, Maybe C.PublicKeyEd25519, Maybe ShortLinkContact)
toMaybeGroupMember :: UTCTime -> Int64 -> MaybeGroupMemberRow -> Maybe GroupMember
toMaybeGroupMember now userContactId ((Just groupMemberId, Just groupId, Just indexInGroup, Just memberId, Just minVer, Just maxVer, Just memberRole, Just memberCategory, Just memberStatus, Just showMessages, memberBlocked') :. (invitedById, invitedByGroupMemberId, Just localDisplayName, memberContactId, Just memberContactProfileId) :. ((Just profileId, Just displayName, Just fullName, shortDescr, image, contactLink, peerType, Just localAlias, contactPreferences) :. badgeRow :. (profileContactDomain, profileContactNameVerification, profileContactDomainProof)) :. (Just createdAt, Just updatedAt) :. (supportChatTs, Just supportChatUnread, Just supportChatUnanswered, Just supportChatMentions, supportChatLastMsgFromMemberTs, memberPubKey, relayLink)) =
Just $ toGroupMember now userContactId ((groupMemberId, groupId, indexInGroup, memberId, minVer, maxVer, memberRole, memberCategory, memberStatus, showMessages, memberBlocked') :. (invitedById, invitedByGroupMemberId, localDisplayName, memberContactId, memberContactProfileId) :. ((profileId, displayName, fullName, shortDescr, image, contactLink, peerType, localAlias, contactPreferences) :. badgeRow :. (profileContactDomain, profileContactNameVerification, profileContactDomainProof)) :. (createdAt, updatedAt) :. (supportChatTs, supportChatUnread, supportChatUnanswered, supportChatMentions, supportChatLastMsgFromMemberTs, memberPubKey, relayLink))
toMaybeGroupMember now userContactId ((Just groupMemberId, Just groupId, Just indexInGroup, Just memberId, Just minVer, Just maxVer, Just memberRole, Just memberCategory, Just memberStatus, Just showMessages, memberBlocked') :. (invitedById, invitedByGroupMemberId, Just localDisplayName, memberContactId, Just memberContactProfileId) :. ((Just profileId, Just displayName, Just fullName, shortDescr, image, contactLink, peerType, Just localAlias, contactPreferences) :. badgeRow :. (profilesimplexName, profileContactNameVerification, profilesimplexNameProof)) :. (Just createdAt, Just updatedAt) :. (supportChatTs, Just supportChatUnread, Just supportChatUnanswered, Just supportChatMentions, supportChatLastMsgFromMemberTs, memberPubKey, relayLink)) =
Just $ toGroupMember now userContactId ((groupMemberId, groupId, indexInGroup, memberId, minVer, maxVer, memberRole, memberCategory, memberStatus, showMessages, memberBlocked') :. (invitedById, invitedByGroupMemberId, localDisplayName, memberContactId, memberContactProfileId) :. ((profileId, displayName, fullName, shortDescr, image, contactLink, peerType, localAlias, contactPreferences) :. badgeRow :. (profilesimplexName, profileContactNameVerification, profilesimplexNameProof)) :. (createdAt, updatedAt) :. (supportChatTs, supportChatUnread, supportChatUnanswered, supportChatMentions, supportChatLastMsgFromMemberTs, memberPubKey, relayLink))
toMaybeGroupMember _ _ _ = Nothing
createGroupLink :: DB.Connection -> TVar ChaChaDRG -> User -> GroupInfo -> ConnId -> CreatedLinkContact -> GroupLinkId -> GroupMemberRole -> SubscriptionMode -> ExceptT StoreError IO GroupLink
@@ -448,7 +448,7 @@ createNewGroup db cxt user@User {userId} groupProfile incognitoProfile useRelays
membersRequireAttention = 0,
viaGroupLinkUri = Nothing,
groupKeys,
groupNameVerification = Nothing
simplexNameVerification = Nothing
}
-- | creates a new group record for the group the current user was invited to, or returns an existing one
@@ -527,7 +527,7 @@ createGroupInvitation db cxt user@User {userId} contact@Contact {contactId, acti
membersRequireAttention = 0,
viaGroupLinkUri = Nothing,
groupKeys = Nothing,
groupNameVerification = Nothing
simplexNameVerification = Nothing
},
groupMemberId
)
@@ -2658,7 +2658,7 @@ updateGroupProfile db user@User {userId} g@GroupInfo {groupId, localDisplayName,
fullGroupPreferences = mergeGroupPreferences groupPreferences
groupClaim pg = claimName <$> (pg >>= publicGroupAccess >>= publicGroupClaim)
claimChanged = groupClaim oldPublicGroup /= groupClaim publicGroup
g' = if claimChanged then (g :: GroupInfo) {groupNameVerification = Nothing} else g
g' = if claimChanged then (g :: GroupInfo) {simplexNameVerification = Nothing} else g
clearVerificationIfClaimChanged =
when claimChanged $
DB.execute db "UPDATE groups SET simplex_name_verification = NULL WHERE user_id = ? AND group_id = ?" (userId, groupId)
+1 -1
View File
@@ -424,7 +424,7 @@ getUserContactProfiles db User {userId} =
(Only userId)
where
toContactProfile :: (ContactName, Text, Maybe Text, Maybe ImageData, Maybe ConnLinkContact, Maybe ChatPeerType, Maybe SimplexNameInfo, Maybe Preferences) -> Profile
toContactProfile (displayName, fullName, shortDescr, image, contactLink, peerType, contactDomain, preferences) = Profile {displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim contactDomain Nothing, peerType, preferences, badge = Nothing}
toContactProfile (displayName, fullName, shortDescr, image, contactLink, peerType, simplexName, preferences) = Profile {displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim simplexName Nothing, peerType, preferences, badge = Nothing}
createUserContactLink :: DB.Connection -> User -> ConnId -> CreatedLinkContact -> SubscriptionMode -> C.PrivateKeyEd25519 -> ExceptT StoreError IO ()
createUserContactLink db User {userId} agentConnId (CCLink cReq shortLink) subMode linkPrivSigKey =
+16 -16
View File
@@ -495,8 +495,8 @@ type ContactRow' = (ProfileId, ContactName, ContactName, Text, Maybe Text, Maybe
type ContactRow = Only ContactId :. ContactRow'
toContact :: UTCTime -> StoreCxt -> User -> [ChatTagId] -> ContactRow :. MaybeConnectionRow -> Contact
toContact now cxt user chatTags ((Only contactId :. (profileId, localDisplayName, displayName, fullName, shortDescr, image, contactLink, peerType, localAlias, BI contactUsed, contactStatus) :. (enableNtfs_, sendRcpts, BI favorite, preferences, userPreferences, createdAt, updatedAt, chatTs) :. preparedContactRow :. (contactRequestId, contactGroupMemberId, BI contactGrpInvSent) :. groupDirectInvRow :. (uiThemes, BI chatDeleted, customData, chatItemTTL) :. badgeRow :. (cpContactDomain, cpContactNameVerification, cpContactDomainProof)) :. connRow) =
let profile = LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim cpContactDomain cpContactDomainProof, contactNameVerification = unBI <$> cpContactNameVerification, peerType, localBadge = rowToBadge now badgeRow, preferences, localAlias}
toContact now cxt user chatTags ((Only contactId :. (profileId, localDisplayName, displayName, fullName, shortDescr, image, contactLink, peerType, localAlias, BI contactUsed, contactStatus) :. (enableNtfs_, sendRcpts, BI favorite, preferences, userPreferences, createdAt, updatedAt, chatTs) :. preparedContactRow :. (contactRequestId, contactGroupMemberId, BI contactGrpInvSent) :. groupDirectInvRow :. (uiThemes, BI chatDeleted, customData, chatItemTTL) :. badgeRow :. (cpsimplexName, cpContactNameVerification, cpsimplexNameProof)) :. connRow) =
let profile = LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim cpsimplexName cpsimplexNameProof, simplexNameVerification = unBI <$> cpContactNameVerification, peerType, localBadge = rowToBadge now badgeRow, preferences, localAlias}
activeConn = toMaybeConnection cxt connRow
chatSettings = ChatSettings {enableNtfs = fromMaybe MFAll enableNtfs_, sendRcpts = unBI <$> sendRcpts, favorite}
incognito = maybe False connIncognito activeConn
@@ -538,8 +538,8 @@ getProfileById db userId profileId = do
type ContactRequestRow = (Int64, ContactName, AgentInvId, Maybe ContactId, Maybe GroupId, Maybe Int64) :. (Int64, ContactName, Text, Maybe Text, Maybe ImageData, Maybe ConnLinkContact, Maybe ChatPeerType, LocalAlias) :. (Maybe XContactId, PQSupport, Maybe SharedMsgId, Maybe SharedMsgId, Maybe Preferences, UTCTime, UTCTime, VersionChat, VersionChat) :. BadgeRow :. (Maybe SimplexNameInfo, Maybe BoolInt, Maybe NameClaimProof)
toContactRequest :: UTCTime -> ContactRequestRow -> UserContactRequest
toContactRequest now ((contactRequestId, localDisplayName, agentInvitationId, contactId_, businessGroupId_, userContactLinkId_) :. (profileId, displayName, fullName, shortDescr, image, contactLink, peerType, localAlias) :. (xContactId, pqSupport, welcomeSharedMsgId, requestSharedMsgId, preferences, createdAt, updatedAt, minVer, maxVer) :. badgeRow :. (contactDomain, contactNameVerification, contactDomainProof)) = do
let profile = LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim contactDomain contactDomainProof, contactNameVerification = unBI <$> contactNameVerification, peerType, preferences, localBadge = rowToBadge now badgeRow, localAlias}
toContactRequest now ((contactRequestId, localDisplayName, agentInvitationId, contactId_, businessGroupId_, userContactLinkId_) :. (profileId, displayName, fullName, shortDescr, image, contactLink, peerType, localAlias) :. (xContactId, pqSupport, welcomeSharedMsgId, requestSharedMsgId, preferences, createdAt, updatedAt, minVer, maxVer) :. badgeRow :. (simplexName, simplexNameVerification, simplexNameProof)) = do
let profile = LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim simplexName simplexNameProof, simplexNameVerification = unBI <$> simplexNameVerification, peerType, preferences, localBadge = rowToBadge now badgeRow, localAlias}
cReqChatVRange = fromMaybe (versionToRange maxVer) $ safeVersionRange minVer maxVer
in UserContactRequest {contactRequestId, agentInvitationId, contactId_, businessGroupId_, userContactLinkId_, cReqChatVRange, localDisplayName, profileId, profile, xContactId, pqSupport, welcomeSharedMsgId, requestSharedMsgId, createdAt, updatedAt}
@@ -555,10 +555,10 @@ userQuery =
|]
toUser :: UTCTime -> (UserId, UserId, ContactId, ProfileId, BoolInt, Int64) :. (ContactName, Text, Maybe Text, Maybe ImageData, Maybe ConnLinkContact, Maybe ChatPeerType, Maybe Preferences) :. (BoolInt, BoolInt, BoolInt, BoolInt, Maybe B64UrlByteString, Maybe B64UrlByteString, Maybe UTCTime, BoolInt, BoolInt, Maybe UIThemeEntityOverrides) :. BadgeRow :. (Maybe SimplexNameInfo, Maybe BoolInt, Maybe NameClaimProof) -> User
toUser now ((userId, auId, userContactId, profileId, BI activeUser, activeOrder) :. (displayName, fullName, shortDescr, image, contactLink, peerType, userPreferences) :. (BI showNtfs, BI sendRcptsContacts, BI sendRcptsSmallGroups, BI autoAcceptMemberContacts, viewPwdHash_, viewPwdSalt_, userMemberProfileUpdatedAt, BI userChatRelay, BI clientService, uiThemes) :. badgeRow :. (contactDomain, contactNameVerification, contactDomainProof)) =
toUser now ((userId, auId, userContactId, profileId, BI activeUser, activeOrder) :. (displayName, fullName, shortDescr, image, contactLink, peerType, userPreferences) :. (BI showNtfs, BI sendRcptsContacts, BI sendRcptsSmallGroups, BI autoAcceptMemberContacts, viewPwdHash_, viewPwdSalt_, userMemberProfileUpdatedAt, BI userChatRelay, BI clientService, uiThemes) :. badgeRow :. (simplexName, simplexNameVerification, simplexNameProof)) =
User {userId, agentUserId = AgentUserId auId, userContactId, localDisplayName = displayName, profile, activeUser, activeOrder, fullPreferences, showNtfs, sendRcptsContacts, sendRcptsSmallGroups, autoAcceptMemberContacts, viewPwdHash, userMemberProfileUpdatedAt, userChatRelay = BoolDef userChatRelay, clientService = BoolDef clientService, uiThemes}
where
profile = LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim contactDomain contactDomainProof, contactNameVerification = unBI <$> contactNameVerification, peerType, localBadge = rowToBadge now badgeRow, preferences = userPreferences, localAlias = ""}
profile = LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim simplexName simplexNameProof, simplexNameVerification = unBI <$> simplexNameVerification, peerType, localBadge = rowToBadge now badgeRow, preferences = userPreferences, localAlias = ""}
fullPreferences = fullPreferences' userPreferences
viewPwdHash = UserPwdHash <$> viewPwdHash_ <*> viewPwdSalt_
@@ -683,7 +683,7 @@ type GroupMemberRow = (GroupMemberId, GroupId, Int64, MemberId, VersionChat, Ver
type ProfileRow = (ProfileId, ContactName, Text, Maybe Text, Maybe ImageData, Maybe ConnLinkContact, Maybe ChatPeerType, LocalAlias, Maybe Preferences) :. BadgeRow :. (Maybe SimplexNameInfo, Maybe BoolInt, Maybe NameClaimProof)
toGroupInfo :: UTCTime -> StoreCxt -> Int64 -> [ChatTagId] -> GroupInfoRow -> GroupInfo
toGroupInfo now cxt userContactId chatTags ((groupId, localDisplayName, displayName, fullName, shortDescr, localAlias, description, image, groupType_, groupLink_, publicGroupId_) :. accessRow :. (enableNtfs_, sendRcpts, BI favorite, groupPreferences, memberAdmission) :. (createdAt, updatedAt, chatTs, userMemberProfileSentAt) :. preparedGroupRow :. businessRow :. (BI useRelays, relayOwnStatus, uiThemes, currentMembers, publicMemberCount, rosterVersion, customData, chatItemTTL, membersRequireAttention, viaGroupLinkUri) :. groupKeysRow :. Only groupNameVerification :. userMemberRow) =
toGroupInfo now cxt userContactId chatTags ((groupId, localDisplayName, displayName, fullName, shortDescr, localAlias, description, image, groupType_, groupLink_, publicGroupId_) :. accessRow :. (enableNtfs_, sendRcpts, BI favorite, groupPreferences, memberAdmission) :. (createdAt, updatedAt, chatTs, userMemberProfileSentAt) :. preparedGroupRow :. businessRow :. (BI useRelays, relayOwnStatus, uiThemes, currentMembers, publicMemberCount, rosterVersion, customData, chatItemTTL, membersRequireAttention, viaGroupLinkUri) :. groupKeysRow :. Only simplexNameVerification :. userMemberRow) =
let membership = (toGroupMember now userContactId userMemberRow) {memberChatVRange = vr cxt}
chatSettings = ChatSettings {enableNtfs = fromMaybe MFAll enableNtfs_, sendRcpts = unBI <$> sendRcpts, favorite}
fullGroupPreferences = mergeGroupPreferences groupPreferences
@@ -693,7 +693,7 @@ toGroupInfo now cxt userContactId chatTags ((groupId, localDisplayName, displayN
businessChat = toBusinessChatInfo businessRow
preparedGroup = toPreparedGroup preparedGroupRow
groupSummary = GroupSummary {currentMembers, publicMemberCount}
in GroupInfo {groupId, useRelays = BoolDef useRelays, relayOwnStatus, localDisplayName, groupProfile, localAlias, businessChat, fullGroupPreferences, membership, chatSettings, createdAt, updatedAt, chatTs, userMemberProfileSentAt, preparedGroup, chatTags, chatItemTTL, uiThemes, groupSummary, rosterVersion, customData, membersRequireAttention, viaGroupLinkUri, groupKeys, groupNameVerification = unBI <$> groupNameVerification}
in GroupInfo {groupId, useRelays = BoolDef useRelays, relayOwnStatus, localDisplayName, groupProfile, localAlias, businessChat, fullGroupPreferences, membership, chatSettings, createdAt, updatedAt, chatTs, userMemberProfileSentAt, preparedGroup, chatTags, chatItemTTL, uiThemes, groupSummary, rosterVersion, customData, membersRequireAttention, viaGroupLinkUri, groupKeys, simplexNameVerification = unBI <$> simplexNameVerification}
toPreparedGroup :: PreparedGroupRow -> Maybe PreparedGroup
toPreparedGroup = \case
@@ -708,17 +708,17 @@ toPublicGroupProfile _ _ _ _ = Nothing
publicGroupAccessRow :: Maybe PublicGroupProfile -> PublicGroupAccessRow
publicGroupAccessRow pgp = case pgp >>= publicGroupAccess of
Just PublicGroupAccess {groupWebPage, simplexName, domainWebPage, allowEmbedding} ->
(groupWebPage, claimName <$> simplexName, Just (BI domainWebPage), Just (BI allowEmbedding), claimProof =<< simplexName)
Just PublicGroupAccess {groupWebPage, simplexName, simplexNameWebPage, allowEmbedding} ->
(groupWebPage, claimName <$> simplexName, Just (BI simplexNameWebPage), Just (BI allowEmbedding), claimProof =<< simplexName)
Nothing -> (Nothing, Nothing, Nothing, Nothing, Nothing)
toPublicGroupAccess :: PublicGroupAccessRow -> Maybe PublicGroupAccess
toPublicGroupAccess (groupWebPage, groupDomain, domainWebPage_, allowEmbedding_, groupDomainProof)
| isJust groupWebPage || isJust groupDomain || domainWebPage || allowEmbedding =
Just PublicGroupAccess {groupWebPage, simplexName = mkSimplexNameClaim groupDomain groupDomainProof, domainWebPage, allowEmbedding}
toPublicGroupAccess (groupWebPage, simplexName, simplexNameWebPage_, allowEmbedding_, simplexNameProof)
| isJust groupWebPage || isJust simplexName || simplexNameWebPage || allowEmbedding =
Just PublicGroupAccess {groupWebPage, simplexName = mkSimplexNameClaim simplexName simplexNameProof, simplexNameWebPage, allowEmbedding}
| otherwise = Nothing
where
domainWebPage = maybe False unBI domainWebPage_
simplexNameWebPage = maybe False unBI simplexNameWebPage_
allowEmbedding = maybe False unBI allowEmbedding_
toGroupKeys :: Maybe B64UrlByteString -> GroupKeysRow -> Maybe GroupKeys
@@ -771,8 +771,8 @@ toContactMember now cxt User {userContactId} (memberRow :. connRow) =
(toGroupMember now userContactId memberRow) {activeConn = toMaybeConnection cxt connRow}
rowToLocalProfile :: UTCTime -> ProfileRow -> LocalProfile
rowToLocalProfile now ((profileId, displayName, fullName, shortDescr, image, contactLink, peerType, localAlias, preferences) :. badgeRow :. (contactDomain, contactNameVerification, contactDomainProof)) =
LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim contactDomain contactDomainProof, contactNameVerification = unBI <$> contactNameVerification, peerType, localBadge = rowToBadge now badgeRow, localAlias, preferences}
rowToLocalProfile now ((profileId, displayName, fullName, shortDescr, image, contactLink, peerType, localAlias, preferences) :. badgeRow :. (simplexName, simplexNameVerification, simplexNameProof)) =
LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, simplexName = mkSimplexNameClaim simplexName simplexNameProof, simplexNameVerification = unBI <$> simplexNameVerification, peerType, localBadge = rowToBadge now badgeRow, localAlias, preferences}
toBusinessChatInfo :: BusinessChatInfoRow -> Maybe BusinessChatInfo
toBusinessChatInfo (Just chatType, Just businessId, Just customerId) = Just BusinessChatInfo {chatType, businessId, customerId}
+5 -5
View File
@@ -498,7 +498,7 @@ data GroupInfo = GroupInfo
membersRequireAttention :: Int,
viaGroupLinkUri :: Maybe ConnReqContact,
groupKeys :: Maybe GroupKeys,
groupNameVerification :: Maybe Bool
simplexNameVerification :: Maybe Bool
}
deriving (Eq, Show)
@@ -784,7 +784,7 @@ data LocalProfile = LocalProfile
localBadge :: Maybe LocalBadge,
localAlias :: LocalAlias,
simplexName :: Maybe SimplexNameClaim,
contactNameVerification :: Maybe Bool
simplexNameVerification :: Maybe Bool
}
deriving (Eq, Show)
@@ -792,8 +792,8 @@ localProfileId :: LocalProfile -> ProfileId
localProfileId LocalProfile {profileId} = profileId
toLocalProfile :: ProfileId -> Profile -> LocalAlias -> UTCTime -> Maybe Bool -> Maybe Bool -> LocalProfile
toLocalProfile profileId Profile {displayName, fullName, shortDescr, image, contactLink, preferences, peerType, badge, simplexName} localAlias now badgeVerified contactNameVerification =
LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, preferences, peerType, localBadge, localAlias, simplexName, contactNameVerification}
toLocalProfile profileId Profile {displayName, fullName, shortDescr, image, contactLink, preferences, peerType, badge, simplexName} localAlias now badgeVerified simplexNameVerification =
LocalProfile {profileId, displayName, fullName, shortDescr, image, contactLink, preferences, peerType, localBadge, localAlias, simplexName, simplexNameVerification}
where
localBadge = (\b@(BadgeProof _ _ _ info) -> PeerBadge b (mkBadgeStatus now badgeVerified info)) <$> badge
@@ -846,7 +846,7 @@ instance ToField GroupType where toField = toField . textEncode
data PublicGroupAccess = PublicGroupAccess
{ groupWebPage :: Maybe Text,
simplexName :: Maybe SimplexNameClaim,
domainWebPage :: Bool,
simplexNameWebPage :: Bool,
allowEmbedding :: Bool
}
deriving (Eq, Show)
+9 -9
View File
@@ -1809,12 +1809,12 @@ viewContactBadge = maybe [] $ \lb ->
in [plain (textEncode badgeType <> " badge - " <> st), plain expiry]
viewContactInfo :: Contact -> Maybe ConnectionStats -> Maybe Profile -> [StyledString]
viewContactInfo ct@Contact {contactId, profile = LocalProfile {localAlias, contactLink, localBadge, simplexName, contactNameVerification}, activeConn, uiThemes, customData} stats incognitoProfile =
viewContactInfo ct@Contact {contactId, profile = LocalProfile {localAlias, contactLink, localBadge, simplexName, simplexNameVerification}, activeConn, uiThemes, customData} stats incognitoProfile =
["contact ID: " <> sShow contactId]
<> viewContactBadge localBadge
<> maybe [] viewConnectionStats stats
<> maybe [] (\l -> ["contact address: " <> plain (strEncode (simplexChatContact' l))]) contactLink
<> simplexNameStatus (claimName <$> simplexName) contactNameVerification (isJust (claimProof =<< simplexName))
<> simplexNameStatus (claimName <$> simplexName) simplexNameVerification (isJust (claimProof =<< simplexName))
<> maybe
["you've shared main profile with this contact"]
(\p -> ["you've shared incognito profile with this contact: " <> incognitoProfile' p])
@@ -2049,10 +2049,10 @@ viewGroupUpdated
access = pg >>= publicGroupAccess
access' = pg' >>= publicGroupAccess
viewAccess Nothing = " removed"
viewAccess (Just PublicGroupAccess {groupWebPage, simplexName, domainWebPage, allowEmbedding}) =
viewAccess (Just PublicGroupAccess {groupWebPage, simplexName, simplexNameWebPage, allowEmbedding}) =
maybe "" (\u -> " web=" <> plain u) groupWebPage
<> maybe "" (\ni -> " domain=" <> plain (strEncode ni)) (claimName <$> simplexName)
<> (if domainWebPage then " domain_page=on" else "")
<> maybe "" (\ni -> " name=" <> plain (strEncode ni)) (claimName <$> simplexName)
<> (if simplexNameWebPage then " name_page=on" else "")
<> (if allowEmbedding then " embed=on" else "")
viewGroupProfile :: GroupInfo -> [StyledString]
@@ -2225,11 +2225,11 @@ viewConnectionPlan ChatConfig {logLevel, testView} _connLink = \case
Just _ -> maybe True (\c -> connStatus c == ConnPrepared) activeConn
_ -> False
contactNameLine :: Contact -> [StyledString]
contactNameLine Contact {profile = LocalProfile {simplexName, contactNameVerification}} =
simplexNameStatus (claimName <$> simplexName) contactNameVerification (isJust (claimProof =<< simplexName))
contactNameLine Contact {profile = LocalProfile {simplexName, simplexNameVerification}} =
simplexNameStatus (claimName <$> simplexName) simplexNameVerification (isJust (claimProof =<< simplexName))
groupNameLine :: GroupInfo -> [StyledString]
groupNameLine g'@GroupInfo {groupNameVerification, groupProfile = GroupProfile {publicGroup}} =
simplexNameStatus (groupSimplexName g') groupNameVerification (isJust (claimProof =<< (publicGroup >>= publicGroupAccess >>= publicGroupClaim)))
groupNameLine g'@GroupInfo {simplexNameVerification, groupProfile = GroupProfile {publicGroup}} =
simplexNameStatus (groupSimplexName g') simplexNameVerification (isJust (claimProof =<< (publicGroup >>= publicGroupAccess >>= publicGroupClaim)))
viewSigVerification = \case
Just OVVerified -> ["owner signature: verified"]
Just (OVFailed r) -> ["owner signature: FAILED (" <> plain r <> ")"]
+3 -3
View File
@@ -119,10 +119,10 @@ testConnectByChannelName ps = withSmpServerAndNames $ \reg ->
withNewTestChat ps "bob" bobProfile $ \bob -> do
(shortLink, _) <- prepareChannel1Relay "team" alice cath
registerName reg teamName (channelNameRecord "team" (T.pack shortLink))
alice ##> "/public group access #team domain=team.simplex"
alice <## "updated public group access: domain=#team.simplex"
alice ##> "/public group access #team name=team.simplex"
alice <## "updated public group access: name=#team.simplex"
cath <## "alice updated group #team: (signed)"
cath <## "updated public group access: domain=#team.simplex"
cath <## "updated public group access: name=#team.simplex"
bob ##> "/c #team.simplex"
bob <## "#team: connection started"
concurrentlyN_