Compare commits
2 commits
disco_info
...
160-regres
Author | SHA1 | Date | |
---|---|---|---|
Bohdan Horbeshko | e55463fc98 | ||
5f99e1cd06 |
|
@ -21,7 +21,6 @@ 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
|
||||||
|
|
|
@ -16,7 +16,6 @@ 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 {
|
||||||
|
@ -49,15 +48,6 @@ 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
|
||||||
|
|
|
@ -114,10 +114,16 @@ func (sm *StreamManager) Stop() {
|
||||||
|
|
||||||
func (sm *StreamManager) connect() error {
|
func (sm *StreamManager) connect() error {
|
||||||
if sm.client != nil {
|
if sm.client != nil {
|
||||||
if c, ok := sm.client.(*Client); ok {
|
var scs *SyncConnState
|
||||||
if c.CurrentState.getState() == StateDisconnected {
|
if client, ok := sm.client.(*Client); ok {
|
||||||
|
scs = &client.CurrentState
|
||||||
|
}
|
||||||
|
if component, ok := sm.client.(*Component); ok {
|
||||||
|
scs = &component.CurrentState
|
||||||
|
}
|
||||||
|
if scs != nil && scs.getState() == StateDisconnected {
|
||||||
sm.Metrics = initMetrics()
|
sm.Metrics = initMetrics()
|
||||||
err := c.Connect()
|
err := sm.client.Connect()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -127,7 +133,6 @@ func (sm *StreamManager) connect() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return errors.New("client is not disconnected")
|
return errors.New("client is not disconnected")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue