2022-12-02 23:18:13 +01:00
|
|
|
package client
|
|
|
|
|
2022-12-18 19:47:44 +01:00
|
|
|
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
|
2022-12-18 20:59:27 +01:00
|
|
|
packedMsg, err := peer.ProcessOutboundUserMessage(usermessage)
|
2022-12-18 19:47:44 +01:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2022-12-02 23:18:13 +01:00
|
|
|
// Creating Server message for transporting the user message
|
2022-12-18 20:36:44 +01:00
|
|
|
toServerMessage := srv.BuildToServerMessageFromUserMessage(packedMsg)
|
2022-12-18 20:59:27 +01:00
|
|
|
return srv.ProcessOutboundMessage(toServerMessage)
|
2022-12-17 19:57:02 +01:00
|
|
|
}
|