2019-06-27 01:22:36 -07:00
|
|
|
package stanza
|
|
|
|
|
|
|
|
import "encoding/xml"
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// Software Version (XEP-0092)
|
|
|
|
|
|
|
|
// Version
|
|
|
|
type Version struct {
|
|
|
|
XMLName xml.Name `xml:"jabber:iq:version query"`
|
|
|
|
Name string `xml:"name,omitempty"`
|
|
|
|
Version string `xml:"version,omitempty"`
|
|
|
|
OS string `xml:"os,omitempty"`
|
2020-01-31 02:48:03 -08:00
|
|
|
// Result sets
|
|
|
|
ResultSet *ResultSet `xml:"set,omitempty"`
|
2019-06-27 01:22:36 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (v *Version) Namespace() string {
|
|
|
|
return v.XMLName.Space
|
|
|
|
}
|
|
|
|
|
2020-01-31 02:48:03 -08:00
|
|
|
func (v *Version) GetSet() *ResultSet {
|
|
|
|
return v.ResultSet
|
|
|
|
}
|
|
|
|
|
2019-07-09 08:53:49 -07:00
|
|
|
// ---------------
|
|
|
|
// Builder helpers
|
|
|
|
|
|
|
|
// Version builds a default software version payload
|
|
|
|
func (iq *IQ) Version() *Version {
|
|
|
|
d := Version{
|
|
|
|
XMLName: xml.Name{Space: "jabber:iq:version", Local: "query"},
|
|
|
|
}
|
|
|
|
iq.Payload = &d
|
|
|
|
return &d
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set all software version info
|
|
|
|
func (v *Version) SetInfo(name, version, os string) *Version {
|
|
|
|
v.Name = name
|
|
|
|
v.Version = version
|
|
|
|
v.OS = os
|
|
|
|
return v
|
|
|
|
}
|
|
|
|
|
2019-06-27 01:22:36 -07:00
|
|
|
// ============================================================================
|
|
|
|
// Registry init
|
|
|
|
|
|
|
|
func init() {
|
2020-01-31 02:48:03 -08:00
|
|
|
TypeRegistry.MapExtension(PKTIQ, xml.Name{Space: "jabber:iq:version", Local: "query"}, Version{})
|
2019-06-27 01:22:36 -07:00
|
|
|
}
|