Skip to content

Commit 38ad3c0

Browse files
authored
agent: function to check if contact address is the same (#1409)
1 parent b2afe6f commit 38ad3c0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Simplex/Messaging/Agent/Protocol.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ module Simplex.Messaging.Agent.Protocol
108108
ConnReqUriData (..),
109109
CRClientData,
110110
ServiceScheme,
111+
sameConnReqContact,
111112
simplexChat,
112113
connReqUriP',
113114
AgentErrorType (..),
@@ -1263,6 +1264,12 @@ instance Eq AConnectionRequestUri where
12631264

12641265
deriving instance Show AConnectionRequestUri
12651266

1267+
sameConnReqContact :: ConnectionRequestUri 'CMContact -> ConnectionRequestUri 'CMContact -> Bool
1268+
sameConnReqContact (CRContactUri ConnReqUriData {crSmpQueues = qs}) (CRContactUri ConnReqUriData {crSmpQueues = qs'}) =
1269+
L.length qs == L.length qs' && all same (L.zip qs qs')
1270+
where
1271+
same (q, q') = sameQAddress (qAddress q) (qAddress q')
1272+
12661273
data ConnReqUriData = ConnReqUriData
12671274
{ crScheme :: ServiceScheme,
12681275
crAgentVRange :: VersionRangeSMPA,

0 commit comments

Comments
 (0)