meowlib/client/message.go
ycc c203431ede
All checks were successful
continuous-integration/drone Build is passing
InternalServer to Server refactor
2023-11-08 22:01:44 +01:00

25 lines
687 B
Go

package client
import "forge.redroom.link/yves/meowlib"
type InternalUserMessage struct {
message *meowlib.UserMessage
dbid int64
}
func ProcessOutboundTextMessage(peer *Peer, text string, srv *Server) ([]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)
}