refactor #2
This commit is contained in:
parent
1257cb70e7
commit
66927c4298
@ -37,7 +37,6 @@ func ProcessOutboundTextMessage(peer *Peer, text string, srv *InternalServer) ([
|
|||||||
}
|
}
|
||||||
// Creating Server message for transporting the user message
|
// Creating Server message for transporting the user message
|
||||||
toServerMessage := srv.BuildToServerMessageFromUserMessage(packedMsg)
|
toServerMessage := srv.BuildToServerMessageFromUserMessage(packedMsg)
|
||||||
|
|
||||||
return ProcessOutboundMessage(toServerMessage, srv)
|
return ProcessOutboundMessage(toServerMessage, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
// 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
|
var msg meowlib.ToServerMessage
|
||||||
msg.Uuid = uuid.New().String()
|
msg.Uuid = uuid.New().String()
|
||||||
msg.Type = "1"
|
msg.Type = "1"
|
||||||
msg.From = ints.Me.Public
|
msg.From = ints.Me.Public
|
||||||
msg.Messages = append(msg.Messages, usermsg)
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user