From 499d0da50f23bb119dee6fef8b4b97e80a9a1191 Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Sun, 12 Apr 2026 15:16:43 +0000 Subject: [PATCH] message and continuation type --- src/Simplex/Chat/Protocol.hs | 9 +++++++++ src/Simplex/Chat/Types.hs | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/src/Simplex/Chat/Protocol.hs b/src/Simplex/Chat/Protocol.hs index 3cf95bbf5f..1221f84515 100644 --- a/src/Simplex/Chat/Protocol.hs +++ b/src/Simplex/Chat/Protocol.hs @@ -432,6 +432,7 @@ data ChatMsgEvent (e :: MsgEncoding) where XMember :: {profile :: Profile, newMemberId :: MemberId, newMemberKey :: MemberKey} -> ChatMsgEvent 'Json XDirectDel :: ChatMsgEvent 'Json XGrpInv :: GroupInvitation -> ChatMsgEvent 'Json + XGrpInvPub :: PublicGroupInvitation -> ChatMsgEvent 'Json XGrpAcpt :: MemberId -> ChatMsgEvent 'Json XGrpLinkInv :: GroupLinkInvitation -> ChatMsgEvent 'Json XGrpLinkReject :: GroupLinkRejection -> ChatMsgEvent 'Json @@ -965,6 +966,7 @@ data CMEventTag (e :: MsgEncoding) where XMember_ :: CMEventTag 'Json XDirectDel_ :: CMEventTag 'Json XGrpInv_ :: CMEventTag 'Json + XGrpInvPub_ :: CMEventTag 'Json XGrpAcpt_ :: CMEventTag 'Json XGrpLinkInv_ :: CMEventTag 'Json XGrpLinkReject_ :: CMEventTag 'Json @@ -1022,6 +1024,7 @@ instance MsgEncodingI e => StrEncoding (CMEventTag e) where XMember_ -> "x.member" XDirectDel_ -> "x.direct.del" XGrpInv_ -> "x.grp.inv" + XGrpInvPub_ -> "x.grp.inv.pub" XGrpAcpt_ -> "x.grp.acpt" XGrpLinkInv_ -> "x.grp.link.inv" XGrpLinkReject_ -> "x.grp.link.reject" @@ -1080,6 +1083,7 @@ instance StrEncoding ACMEventTag where "x.member" -> XMember_ "x.direct.del" -> XDirectDel_ "x.grp.inv" -> XGrpInv_ + "x.grp.inv.pub" -> XGrpInvPub_ "x.grp.acpt" -> XGrpAcpt_ "x.grp.link.inv" -> XGrpLinkInv_ "x.grp.link.reject" -> XGrpLinkReject_ @@ -1134,6 +1138,7 @@ toCMEventTag msg = case msg of XMember {} -> XMember_ XDirectDel -> XDirectDel_ XGrpInv _ -> XGrpInv_ + XGrpInvPub _ -> XGrpInvPub_ XGrpAcpt _ -> XGrpAcpt_ XGrpLinkInv _ -> XGrpLinkInv_ XGrpLinkReject _ -> XGrpLinkReject_ @@ -1192,6 +1197,7 @@ hasNotification = \case XFile_ -> True XContact_ -> True XGrpInv_ -> True + XGrpInvPub_ -> True XGrpMemFwd_ -> True XGrpDel_ -> True XCallInv_ -> True @@ -1201,6 +1207,7 @@ hasDeliveryReceipt :: CMEventTag e -> Bool hasDeliveryReceipt = \case XMsgNew_ -> True XGrpInv_ -> True + XGrpInvPub_ -> True XCallInv_ -> True _ -> False @@ -1287,6 +1294,7 @@ appJsonToCM AppMessageJson {v, msgId, event, params} = do XMember_ -> XMember <$> p "profile" <*> p "newMemberId" <*> p "newMemberKey" XDirectDel_ -> pure XDirectDel XGrpInv_ -> XGrpInv <$> p "groupInvitation" + XGrpInvPub_ -> XGrpInvPub <$> p "groupInvitation" XGrpAcpt_ -> XGrpAcpt <$> p "memberId" XGrpLinkInv_ -> XGrpLinkInv <$> p "groupLinkInvitation" XGrpLinkReject_ -> XGrpLinkReject <$> p "groupLinkRejection" @@ -1358,6 +1366,7 @@ chatToAppMessage chatMsg@ChatMessage {chatVRange, msgId, chatMsgEvent} = case en XMember {profile, newMemberId, newMemberKey} -> o ["profile" .= profile, "newMemberId" .= newMemberId, "newMemberKey" .= newMemberKey] XDirectDel -> JM.empty XGrpInv groupInv -> o ["groupInvitation" .= groupInv] + XGrpInvPub groupInv -> o ["groupInvitation" .= groupInv] XGrpAcpt memId -> o ["memberId" .= memId] XGrpLinkInv groupLinkInv -> o ["groupLinkInvitation" .= groupLinkInv] XGrpLinkReject groupLinkRjct -> o ["groupLinkRejection" .= groupLinkRjct] diff --git a/src/Simplex/Chat/Types.hs b/src/Simplex/Chat/Types.hs index 30ae269b61..b24d3e0a0c 100644 --- a/src/Simplex/Chat/Types.hs +++ b/src/Simplex/Chat/Types.hs @@ -1900,6 +1900,7 @@ data CommandFunction | CFSetShortLink | CFGetRelayDataJoin | CFGetRelayDataAccept + | CFGetGroupDataInv deriving (Eq, Show) instance FromField CommandFunction where fromField = fromTextField_ textDecode @@ -1920,6 +1921,7 @@ instance TextEncoding CommandFunction where "set_short_link" -> Just CFSetShortLink "get_relay_data_join" -> Just CFGetRelayDataJoin "get_relay_data_accept" -> Just CFGetRelayDataAccept + "get_group_data_inv" -> Just CFGetGroupDataInv _ -> Nothing textEncode = \case CFCreateConnGrpMemInv -> "create_conn" @@ -1934,6 +1936,7 @@ instance TextEncoding CommandFunction where CFSetShortLink -> "set_short_link" CFGetRelayDataJoin -> "get_relay_data_join" CFGetRelayDataAccept -> "get_relay_data_accept" + CFGetGroupDataInv -> "get_group_data_inv" commandExpectedResponse :: CommandFunction -> AEvtTag commandExpectedResponse = \case @@ -1949,6 +1952,7 @@ commandExpectedResponse = \case CFSetShortLink -> t LINK_ CFGetRelayDataJoin -> t LDATA_ CFGetRelayDataAccept -> t LDATA_ + CFGetGroupDataInv -> t LDATA_ where t = AEvtTag SAEConn