Respond with status OK on every command message

This commit is contained in:
2021-09-15 17:20:11 +02:00
parent bfebfab3af
commit 4d7a973293
2 changed files with 5 additions and 1 deletions

View File

@@ -10,7 +10,10 @@ func main() {
// LOAD APPLICATION CONFIGURATION
appConfig.Load()
// Initialise XMPP service
xmppService.Init()
// Send online presence stanza
xmppServiceInstance := xmppService.Instance()
xmppService.SendOnlinePresenceStanza(xmppServiceInstance.XMPPClients[0].Client, xmppServiceInstance.XMPPClients[0].Config.Jid)
}

View File

@@ -124,8 +124,9 @@ func handleMessage(s xmpp.Sender, p stanza.Packet) {
return
}
log.Printf("Received The message %v", msg)
_, _ = fmt.Fprintf(os.Stdout, "Body = %s - from = %s\n", msg.Body, msg.From)
reply := stanza.Message{Attrs: stanza.Attrs{To: msg.From}, Body: msg.Body}
reply := stanza.Message{Attrs: stanza.Attrs{To: msg.From}, Body: `{"status": "OK"}`}
err := s.Send(reply)
log.Printf("Error sending message %v", err)
}