Added uuid to message_id, and uiid params in command message reply

This commit is contained in:
2021-09-27 10:23:31 +02:00
parent b35cb62e1e
commit b393655a5e
4 changed files with 20 additions and 13 deletions

View File

@@ -12,6 +12,7 @@ import (
"sync"
"time"
"github.com/twinj/uuid"
appConfig "github.com/xmpploadtesting/config"
"gosrc.io/xmpp"
"gosrc.io/xmpp/stanza"
@@ -278,9 +279,11 @@ func handleMessage(s xmpp.Sender, p stanza.Packet) {
log.Printf("<%v> unable to unmarshal Command Meassage: %v", msg.To, msg.Body)
}
if len(commandMessageResponse.Responses) > 0 || len(commandMessage.Commands) > 0 {
commandMessageResponse.Responses[0].UUID = commandMessage.Commands[0].UUID
messageIDUUID := uuid.NewV4().String()
commandMessageUUID := uuid.NewV4().String()
commandMessageResponse.Responses[0].UUID = commandMessageUUID
commandMessageResponse.PlayerID = commandMessage.Commands[0].Params.PlayerID
commandMessageResponse.MessageID = commandMessage.MessageID
commandMessageResponse.MessageID = messageIDUUID
} else {
log.Printf("<%v> There are no commands inside command message : %v", msg.To, commandMessage)