18 lines
571 B
Go
18 lines
571 B
Go
package client
|
|
|
|
func ProcessOutboundTextMessage(peer *Peer, text string, srv *InternalServer) ([]byte, error) {
|
|
// Creating User message
|
|
usermessage, err := peer.BuildSimpleUserMessage([]byte(text))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
// Prepare cyphered + packed user message
|
|
packedMsg, err := peer.ProcessOutboundUserMessage(usermessage)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
// Creating Server message for transporting the user message
|
|
toServerMessage := srv.BuildToServerMessageFromUserMessage(packedMsg)
|
|
return srv.ProcessOutboundMessage(toServerMessage)
|
|
}
|