Respond with status OK on every command message
This commit is contained in:
3
main.go
3
main.go
@@ -10,7 +10,10 @@ func main() {
|
|||||||
// LOAD APPLICATION CONFIGURATION
|
// LOAD APPLICATION CONFIGURATION
|
||||||
appConfig.Load()
|
appConfig.Load()
|
||||||
|
|
||||||
|
// Initialise XMPP service
|
||||||
xmppService.Init()
|
xmppService.Init()
|
||||||
|
|
||||||
|
// Send online presence stanza
|
||||||
xmppServiceInstance := xmppService.Instance()
|
xmppServiceInstance := xmppService.Instance()
|
||||||
xmppService.SendOnlinePresenceStanza(xmppServiceInstance.XMPPClients[0].Client, xmppServiceInstance.XMPPClients[0].Config.Jid)
|
xmppService.SendOnlinePresenceStanza(xmppServiceInstance.XMPPClients[0].Client, xmppServiceInstance.XMPPClients[0].Config.Jid)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,8 +124,9 @@ func handleMessage(s xmpp.Sender, p stanza.Packet) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Printf("Received The message %v", msg)
|
||||||
_, _ = fmt.Fprintf(os.Stdout, "Body = %s - from = %s\n", msg.Body, msg.From)
|
_, _ = 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)
|
err := s.Send(reply)
|
||||||
log.Printf("Error sending message %v", err)
|
log.Printf("Error sending message %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user