mirror of
https://github.com/FluuxIO/go-xmpp.git
synced 2024-11-21 10:02:00 -08:00
Update component to advertise version feature and return it
This commit is contained in:
parent
322a6594e7
commit
08bb9965b8
@ -6,5 +6,5 @@ require (
|
||||
github.com/google/go-cmp v0.3.0 // indirect
|
||||
github.com/processone/mpg123 v1.0.0
|
||||
github.com/processone/soundcloud v1.0.0
|
||||
gosrc.io/xmpp v0.0.0-20190609110825-bc2fad6693da
|
||||
gosrc.io/xmpp v0.0.0-20190610103001-322a6594e7f9
|
||||
)
|
||||
|
@ -7,3 +7,7 @@ golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522 h1:bhOzK9QyoD0ogCnFro1m2
|
||||
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gosrc.io/xmpp v0.0.0-20190609110825-bc2fad6693da h1:LmOtwrmeUIWTG87zgPc99ouMPDowrRtgEsCKKvkmanQ=
|
||||
gosrc.io/xmpp v0.0.0-20190609110825-bc2fad6693da/go.mod h1:6NJG4vRCxQJMGLxIdroPLPd++FPLOmDqJdJEt2mu4kQ=
|
||||
gosrc.io/xmpp v0.0.0-20190610095607-45cb2e6f343a h1:CUG1rGnMuMYUX2y9N/uPaDe/CS27GdNnxhnSmBAjCic=
|
||||
gosrc.io/xmpp v0.0.0-20190610095607-45cb2e6f343a/go.mod h1:6NJG4vRCxQJMGLxIdroPLPd++FPLOmDqJdJEt2mu4kQ=
|
||||
gosrc.io/xmpp v0.0.0-20190610103001-322a6594e7f9 h1:CJpDd5q0iH08ntle+uO5XNx+EGUycafYYR175pyPqOQ=
|
||||
gosrc.io/xmpp v0.0.0-20190610103001-322a6594e7f9/go.mod h1:6NJG4vRCxQJMGLxIdroPLPd++FPLOmDqJdJEt2mu4kQ=
|
||||
|
@ -44,6 +44,11 @@ func main() {
|
||||
if p.Type == "get" {
|
||||
discoItems(component, p.PacketAttrs, inner)
|
||||
}
|
||||
case *xmpp.Version:
|
||||
fmt.Println("Version")
|
||||
if p.Type == "get" {
|
||||
version(component, p.PacketAttrs)
|
||||
}
|
||||
default:
|
||||
fmt.Println("ignoring iq packet", inner)
|
||||
xError := xmpp.Err{
|
||||
@ -83,6 +88,7 @@ func discoResult(c *xmpp.Component, attrs xmpp.PacketAttrs, info *xmpp.DiscoInfo
|
||||
Features: []xmpp.Feature{
|
||||
{Var: xmpp.NSDiscoInfo},
|
||||
{Var: xmpp.NSDiscoItems},
|
||||
{Var: "jabber:iq:version"},
|
||||
},
|
||||
}
|
||||
iq.AddPayload(&payload)
|
||||
@ -104,3 +110,13 @@ func discoItems(c *xmpp.Component, attrs xmpp.PacketAttrs, items *xmpp.DiscoItem
|
||||
iq.AddPayload(&payload)
|
||||
_ = c.Send(iq)
|
||||
}
|
||||
|
||||
func version(c *xmpp.Component, attrs xmpp.PacketAttrs) {
|
||||
iq := xmpp.NewIQ("result", attrs.To, attrs.From, attrs.Id, "en")
|
||||
|
||||
var payload xmpp.Version
|
||||
payload.Name = "Fluux XMPP Component"
|
||||
payload.Version = "0.0.1"
|
||||
iq.AddPayload(&payload)
|
||||
_ = c.Send(iq)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user