forked from jshiffer/go-xmpp
keep IQ struct unchange
This commit is contained in:
parent
65fd08aee2
commit
ef6a1a617c
22
xmpp.go
22
xmpp.go
@ -619,12 +619,11 @@ type Presence struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type IQ struct {
|
type IQ struct {
|
||||||
ID string
|
ID string
|
||||||
From string
|
From string
|
||||||
To string
|
To string
|
||||||
Type string
|
Type string
|
||||||
Query string
|
Query []byte
|
||||||
QueryName xml.Name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recv waits to receive the next XMPP stanza.
|
// Recv waits to receive the next XMPP stanza.
|
||||||
@ -668,8 +667,15 @@ func (c *Client) Recv() (stanza interface{}, err error) {
|
|||||||
return Chat{}, err
|
return Chat{}, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return IQ{ID: v.ID, From: v.From, To: v.To, Type: v.Type,
|
if v.Query.XMLName.Local == "" {
|
||||||
Query: v.Query.InnerXML, QueryName: v.Query.XMLName}, nil
|
return IQ{ID: v.ID, From: v.From, To: v.To, Type: v.Type}, nil
|
||||||
|
} else if res, err := xml.Marshal(v.Query); err != nil {
|
||||||
|
// should never occur
|
||||||
|
return Chat{}, err
|
||||||
|
} else {
|
||||||
|
return IQ{ID: v.ID, From: v.From, To: v.To, Type: v.Type,
|
||||||
|
Query: res}, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user