From 38ad3c046e1bd5eb1ffe696dd24b10dd69001ba2 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Mon, 2 Dec 2024 11:41:06 +0000 Subject: [PATCH] agent: function to check if contact address is the same (#1409) --- src/Simplex/Messaging/Agent/Protocol.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Simplex/Messaging/Agent/Protocol.hs b/src/Simplex/Messaging/Agent/Protocol.hs index 17ebb7d43..08e8add24 100644 --- a/src/Simplex/Messaging/Agent/Protocol.hs +++ b/src/Simplex/Messaging/Agent/Protocol.hs @@ -108,6 +108,7 @@ module Simplex.Messaging.Agent.Protocol ConnReqUriData (..), CRClientData, ServiceScheme, + sameConnReqContact, simplexChat, connReqUriP', AgentErrorType (..), @@ -1263,6 +1264,12 @@ instance Eq AConnectionRequestUri where deriving instance Show AConnectionRequestUri +sameConnReqContact :: ConnectionRequestUri 'CMContact -> ConnectionRequestUri 'CMContact -> Bool +sameConnReqContact (CRContactUri ConnReqUriData {crSmpQueues = qs}) (CRContactUri ConnReqUriData {crSmpQueues = qs'}) = + L.length qs == L.length qs' && all same (L.zip qs qs') + where + same (q, q') = sameQAddress (qAddress q) (qAddress q') + data ConnReqUriData = ConnReqUriData { crScheme :: ServiceScheme, crAgentVRange :: VersionRangeSMPA,