Fixed online presence stanza message

This commit is contained in:
2021-09-15 17:35:35 +02:00
parent 4d7a973293
commit 48754c96bb

View File

@@ -12,7 +12,8 @@ import (
"gosrc.io/xmpp/stanza"
)
const rolingStockPresenceMessage = `ROLLING STOCK PRESENCE MESSAGE\n +{
const rolingStockPresenceMessage = `ROLLING STOCK PRESENCE MESSAGE\n
{
"serial": "79101X02Y0029450001CJ2000",
"model": "VEN032FSNWM00",
"displayOrientation": "left",
@@ -36,8 +37,7 @@ const rolingStockPresenceMessage = `ROLLING STOCK PRESENCE MESSAGE\n +{
"architecture": "x86-64"
},
"digiID": "digi-00000000-00000000-0040FFFF-FF801D30"
}
`
}`
// XMPPService - struct containing
type XMPPService struct {
@@ -128,7 +128,10 @@ func handleMessage(s xmpp.Sender, p stanza.Packet) {
_, _ = fmt.Fprintf(os.Stdout, "Body = %s - from = %s\n", msg.Body, msg.From)
reply := stanza.Message{Attrs: stanza.Attrs{To: msg.From}, Body: `{"status": "OK"}`}
err := s.Send(reply)
log.Printf("Error sending message %v", err)
if err != nil {
log.Printf("Error sending to %v message %v", msg.From, err)
}
}
func errorHandler(err error) {