meowlib/client/message.go
ycc 05cc2ee218
Some checks failed
continuous-integration/drone/push Build is failing
Refactor client message handling and storage
2024-02-17 19:30:25 +01:00

26 lines
703 B
Go

package client
import "forge.redroom.link/yves/meowlib"
type InternalUserMessage struct {
Message *meowlib.UserMessage
Dbfile string
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)
}