sum7
/
yaja
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
yaja/server/extension/iq_ping.go

34 lines
636 B
Go
Raw Normal View History

package extension
import (
2018-02-07 15:34:18 +01:00
"dev.sum7.eu/genofire/yaja/server/utils"
"dev.sum7.eu/genofire/yaja/xmpp"
"dev.sum7.eu/genofire/yaja/xmpp/base"
)
2017-12-17 15:39:36 +01:00
type IQPing struct {
IQExtension
}
2017-12-17 15:39:36 +01:00
func (ex *IQPing) Spaces() []string { return []string{"urn:xmpp:ping"} }
func (ex *IQPing) Get(msg *xmpp.IQClient, client *utils.Client) bool {
log := client.Log.WithField("extension", "ping").WithField("id", msg.ID)
2018-02-10 13:34:42 +01:00
if msg.Ping == nil {
return false
}
// reply
client.Messages <- &xmpp.IQClient{
Type: xmpp.IQTypeResult,
2018-02-10 13:34:42 +01:00
To: client.JID,
From: xmppbase.NewJID(client.JID.Domain),
ID: msg.ID,
2017-12-17 15:39:36 +01:00
}
log.Debug("send")
return true
}