From 54c36c68adf66fdeef2d8d4f682035fd4265babe Mon Sep 17 00:00:00 2001 From: ycc Date: Sun, 31 Mar 2024 18:22:17 +0200 Subject: [PATCH] Fix invitation answer message building with inv_id --- client/helpers/invitationAnswerHelper.go | 2 +- client/server.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/helpers/invitationAnswerHelper.go b/client/helpers/invitationAnswerHelper.go index 5222ef2..0bfad35 100644 --- a/client/helpers/invitationAnswerHelper.go +++ b/client/helpers/invitationAnswerHelper.go @@ -119,7 +119,7 @@ func InvitationAnswerMessage(invitationId string, invitationServerUid string, ti return nil, "InvitationAnswerMessage: ProcessOutboundUserMessage", err } // Creating Server message for transporting the user message - toServerMessage, err := invitationServer.BuildToServerMessageInvitationAnswer(packedMsg, peer.MyIdentity.Public, timeout) + toServerMessage, err := invitationServer.BuildToServerMessageInvitationAnswer(packedMsg, peer.MyIdentity.Public, invitationId, timeout) if err != nil { return nil, "InvitationAnswerMessage: BuildToServerMessageInvitationAnswer", err } diff --git a/client/server.go b/client/server.go index 30e30f9..1db3b39 100644 --- a/client/server.go +++ b/client/server.go @@ -167,7 +167,7 @@ func (ints *Server) BuildMessageRequestMessage(lookupKeys []string) ([]byte, err // BuildToServerMessageInvitation creates an invitation message to server and returns it as a meowlib.ToServerMessage // it takes as input a contactcard generated by Identity.InvitePeer -func (ints *Server) BuildToServerMessageInvitationCreation(invitation *meowlib.ContactCard, password string, timeout int, invitationIdLen int) (*meowlib.ToServerMessage, error) { +func (ints *Server) BuildToServerMessageInvitationCreation(invitation *meowlib.ContactCard, password string, timeout int, shortCodeLen int) (*meowlib.ToServerMessage, error) { var msg meowlib.ToServerMessage var inv meowlib.Invitation payload, err := invitation.Compress() @@ -179,7 +179,7 @@ func (ints *Server) BuildToServerMessageInvitationCreation(invitation *meowlib.C inv.Step = 1 inv.Password = password inv.Timeout = int32(timeout) - inv.ShortcodeLen = int32(invitationIdLen) + inv.ShortcodeLen = int32(shortCodeLen) inv.Payload = payload msg.Invitation = &inv return &msg, nil @@ -200,7 +200,7 @@ func (ints *Server) BuildToServerMessageInvitationRequest(shortcode string, pass // BuildToServerMessageInvitationAnswer creates an invitation answer to server and returns it as a meowlib.ToServerMessage // it takes as input a contactcard generated by Identity.InvitePeer -func (ints *Server) BuildToServerMessageInvitationAnswer(invitationAnswer *meowlib.PackedUserMessage, myPublicKeyForThatPeer string, timeout int) (*meowlib.ToServerMessage, error) { +func (ints *Server) BuildToServerMessageInvitationAnswer(invitationAnswer *meowlib.PackedUserMessage, myPublicKeyForThatPeer string, invitation_id string, timeout int) (*meowlib.ToServerMessage, error) { var msg meowlib.ToServerMessage var inv meowlib.Invitation invitationPayload, err := proto.Marshal(invitationAnswer) @@ -208,6 +208,7 @@ func (ints *Server) BuildToServerMessageInvitationAnswer(invitationAnswer *meowl return nil, err } inv.Step = 3 + inv.Uuid = invitation_id msg.Type = "1" msg.From = ints.UserKp.Public inv.From = myPublicKeyForThatPeer