mirror of
https://github.com/FluuxIO/go-xmpp.git
synced 2024-12-03 07:42:00 -08:00
Simplify disco with builder helpers
This commit is contained in:
parent
0b0c0fa5ab
commit
5c76c9c0a0
@ -99,26 +99,9 @@ func discoInfo(c xmpp.Sender, p stanza.Packet, opts xmpp.ComponentOptions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func discoInfoRoot(iqResp *stanza.IQ, opts xmpp.ComponentOptions) {
|
func discoInfoRoot(iqResp *stanza.IQ, opts xmpp.ComponentOptions) {
|
||||||
// Higher level discovery
|
disco := iqResp.DiscoInfo()
|
||||||
identity := stanza.Identity{
|
disco.AddIdentity(opts.Name, opts.Category, opts.Type)
|
||||||
Name: opts.Name,
|
disco.AddFeatures(stanza.NSDiscoInfo, stanza.NSDiscoItems, "jabber:iq:version", "urn:xmpp:delegation:1")
|
||||||
Category: opts.Category,
|
|
||||||
Type: opts.Type,
|
|
||||||
}
|
|
||||||
payload := stanza.DiscoInfo{
|
|
||||||
XMLName: xml.Name{
|
|
||||||
Space: stanza.NSDiscoInfo,
|
|
||||||
Local: "query",
|
|
||||||
},
|
|
||||||
Identity: []stanza.Identity{identity},
|
|
||||||
Features: []stanza.Feature{
|
|
||||||
{Var: stanza.NSDiscoInfo},
|
|
||||||
{Var: stanza.NSDiscoItems},
|
|
||||||
{Var: "jabber:iq:version"},
|
|
||||||
{Var: "urn:xmpp:delegation:1"},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
iqResp.Payload = &payload
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func discoInfoPubSub(iqResp *stanza.IQ) {
|
func discoInfoPubSub(iqResp *stanza.IQ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user