Merge branch 'disco_info_form' into process-one-is-lazy

This commit is contained in:
Bohdan Horbeshko 2022-07-08 14:44:40 -04:00
commit 35d9cd68e5
2 changed files with 11 additions and 0 deletions

View file

@ -21,6 +21,7 @@ type DiscoInfo struct {
Identity []Identity `xml:"identity"` Identity []Identity `xml:"identity"`
Features []Feature `xml:"feature"` Features []Feature `xml:"feature"`
ResultSet *ResultSet `xml:"set,omitempty"` ResultSet *ResultSet `xml:"set,omitempty"`
Form *Form `xml:"x,omitempty"`
} }
// Namespace lets DiscoInfo implement the IQPayload interface // Namespace lets DiscoInfo implement the IQPayload interface

View file

@ -16,6 +16,7 @@ func TestDiscoInfo_Builder(t *testing.T) {
disco := iq.DiscoInfo() disco := iq.DiscoInfo()
disco.AddIdentity("Test Component", "gateway", "service") disco.AddIdentity("Test Component", "gateway", "service")
disco.AddFeatures(stanza.NSDiscoInfo, stanza.NSDiscoItems, "jabber:iq:version", "urn:xmpp:delegation:1") disco.AddFeatures(stanza.NSDiscoInfo, stanza.NSDiscoItems, "jabber:iq:version", "urn:xmpp:delegation:1")
disco.Form = stanza.NewForm([]*stanza.Field{}, "result")
parsedIQ, err := checkMarshalling(t, iq) parsedIQ, err := checkMarshalling(t, iq)
if err != nil { if err != nil {
@ -48,6 +49,15 @@ func TestDiscoInfo_Builder(t *testing.T) {
t.Errorf("Incorrect identity name: %#v", pp.Identity[0].Name) t.Errorf("Incorrect identity name: %#v", pp.Identity[0].Name)
} }
} }
// Check form
if pp.Form == nil {
t.Errorf("Form is nil")
} else {
if len(pp.Form.Fields) != 0 {
t.Errorf("Form fields length mismatch: %#v", pp.Form.Fields)
}
}
} }
// Implements XEP-0030 example 17 // Implements XEP-0030 example 17