diff --git a/client/message.go b/client/message.go index 22ca8f4..d68caf3 100644 --- a/client/message.go +++ b/client/message.go @@ -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) } diff --git a/client/server.go b/client/server.go index c07f3ff..aa2092a 100644 --- a/client/server.go +++ b/client/server.go @@ -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 }