From 70ce59194bb1a48daa2e21b7fbe6571883165700 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Thu, 23 Oct 2025 15:52:26 +0400 Subject: [PATCH] XGrpRelayReady --- src/Simplex/Chat/Protocol.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Simplex/Chat/Protocol.hs b/src/Simplex/Chat/Protocol.hs index cb7f645608..c2eaed29be 100644 --- a/src/Simplex/Chat/Protocol.hs +++ b/src/Simplex/Chat/Protocol.hs @@ -330,6 +330,7 @@ data ChatMsgEvent (e :: MsgEncoding) where XGrpLinkAcpt :: GroupAcceptance -> GroupMemberRole -> MemberId -> ChatMsgEvent 'Json XGrpRelayInv :: ConnLinkContact -> ChatMsgEvent 'Json XGrpRelayAcpt :: ConnLinkContact -> ChatMsgEvent 'Json -- TODO [chat relays] TBC short/long/any + XGrpRelayReady :: ChatMsgEvent 'Json XGrpMemNew :: MemberInfo -> Maybe MsgScope -> ChatMsgEvent 'Json XGrpMemIntro :: MemberInfo -> Maybe MemberRestrictions -> ChatMsgEvent 'Json XGrpMemInv :: MemberId -> IntroInvitation -> ChatMsgEvent 'Json @@ -820,6 +821,7 @@ data CMEventTag (e :: MsgEncoding) where XGrpLinkAcpt_ :: CMEventTag 'Json XGrpRelayInv_ :: CMEventTag 'Json XGrpRelayAcpt_ :: CMEventTag 'Json + XGrpRelayReady_ :: CMEventTag 'Json XGrpMemNew_ :: CMEventTag 'Json XGrpMemIntro_ :: CMEventTag 'Json XGrpMemInv_ :: CMEventTag 'Json @@ -875,6 +877,7 @@ instance MsgEncodingI e => StrEncoding (CMEventTag e) where XGrpLinkAcpt_ -> "x.grp.link.acpt" XGrpRelayInv_ -> "x.grp.relay.inv" XGrpRelayAcpt_ -> "x.grp.relay.acpt" + XGrpRelayReady_ -> "x.grp.relay.ready" XGrpMemNew_ -> "x.grp.mem.new" XGrpMemIntro_ -> "x.grp.mem.intro" XGrpMemInv_ -> "x.grp.mem.inv" @@ -931,6 +934,7 @@ instance StrEncoding ACMEventTag where "x.grp.link.acpt" -> XGrpLinkAcpt_ "x.grp.relay.inv" -> XGrpRelayInv_ "x.grp.relay.acpt" -> XGrpRelayAcpt_ + "x.grp.relay.ready" -> XGrpRelayReady_ "x.grp.mem.new" -> XGrpMemNew_ "x.grp.mem.intro" -> XGrpMemIntro_ "x.grp.mem.inv" -> XGrpMemInv_ @@ -983,6 +987,7 @@ toCMEventTag msg = case msg of XGrpLinkAcpt {} -> XGrpLinkAcpt_ XGrpRelayInv _ -> XGrpRelayInv_ XGrpRelayAcpt _ -> XGrpRelayAcpt_ + XGrpRelayReady -> XGrpRelayReady_ XGrpMemNew {} -> XGrpMemNew_ XGrpMemIntro _ _ -> XGrpMemIntro_ XGrpMemInv _ _ -> XGrpMemInv_ @@ -1102,6 +1107,7 @@ appJsonToCM AppMessageJson {v, msgId, event, params} = do XGrpLinkAcpt_ -> XGrpLinkAcpt <$> p "acceptance" <*> p "role" <*> p "memberId" XGrpRelayInv_ -> XGrpRelayInv <$> p "groupLink" XGrpRelayAcpt_ -> XGrpRelayAcpt <$> p "relayLink" + XGrpRelayReady_ -> pure XGrpRelayReady XGrpMemNew_ -> XGrpMemNew <$> p "memberInfo" <*> opt "scope" XGrpMemIntro_ -> XGrpMemIntro <$> p "memberInfo" <*> opt "memberRestrictions" XGrpMemInv_ -> XGrpMemInv <$> p "memberId" <*> p "memberIntro" @@ -1163,6 +1169,7 @@ chatToAppMessage chatMsg@ChatMessage {chatVRange, msgId, chatMsgEvent} = case en XGrpLinkAcpt acceptance role memberId -> o ["acceptance" .= acceptance, "role" .= role, "memberId" .= memberId] XGrpRelayInv groupLink -> o ["groupLink" .= groupLink] XGrpRelayAcpt relayLink -> o ["relayLink" .= relayLink] + XGrpRelayReady -> JM.empty XGrpMemNew memInfo scope -> o $ ("scope" .=? scope) ["memberInfo" .= memInfo] XGrpMemIntro memInfo memRestrictions -> o $ ("memberRestrictions" .=? memRestrictions) ["memberInfo" .= memInfo] XGrpMemInv memId memIntro -> o ["memberId" .= memId, "memberIntro" .= memIntro]