This commit is contained in:
ycc 2022-12-18 20:37:26 +01:00
parent 1257cb70e7
commit 66927c4298
2 changed files with 8 additions and 3 deletions

View File

@ -37,7 +37,6 @@ func ProcessOutboundTextMessage(peer *Peer, text string, srv *InternalServer) ([
}
// Creating Server message for transporting the user message
toServerMessage := srv.BuildToServerMessageFromUserMessage(packedMsg)
return ProcessOutboundMessage(toServerMessage, srv)
}

View File

@ -64,13 +64,19 @@ func (ints *InternalServer) AsymDecryptMessage(Message []byte, Signature []byte)
}
// Creates a basic message to server from a single packed user message and returns it as protobuf serialized byte array
func (ints *InternalServer) BuildMessageSendingMessage(usermsg *meowlib.PackedUserMessage) ([]byte, error) {
func (ints *InternalServer) BuildToServerMessageFromUserMessage(usermsg *meowlib.PackedUserMessage) *meowlib.ToServerMessage {
var msg meowlib.ToServerMessage
msg.Uuid = uuid.New().String()
msg.Type = "1"
msg.From = ints.Me.Public
msg.Messages = append(msg.Messages, usermsg)
out, err := proto.Marshal(&msg)
return &msg
}
// Creates a basic message to server from a single packed user message and returns it as protobuf serialized byte array
func (ints *InternalServer) BuildMessageSendingMessage(usermsg *meowlib.PackedUserMessage) ([]byte, error) {
msg := ints.BuildToServerMessageFromUserMessage(usermsg)
out, err := proto.Marshal(msg)
if err != nil {
return nil, err
}