Add builder & test on software version helpers

This commit is contained in:
Mickael Remond
2019-07-09 17:53:49 +02:00
parent 0e3101c2be
commit 6872ed8d1b
4 changed files with 69 additions and 3 deletions
+20
View File
@@ -17,6 +17,26 @@ func (v *Version) Namespace() string {
return v.XMLName.Space
}
// ---------------
// 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
}
// ============================================================================
// Registry init