Provide error replies for IQs. (#135)

This should fix #125.
This commit is contained in:
Martin 2022-03-19 21:58:56 +08:00 committed by GitHub
parent 912ba61489
commit e773596ea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -721,6 +721,14 @@ func (c *Client) Recv() (stanza interface{}, err error) {
return PubsubSubscription{ return PubsubSubscription{
Errors: errsStr, Errors: errsStr,
}, nil }, nil
default:
res, err := xml.Marshal(v.Query)
if err != nil {
return Chat{}, err
}
return IQ{ID: v.ID, From: v.From, To: v.To, Type: v.Type,
Query: res}, nil
} }
case v.Type == "result" && v.ID == "unsub1": case v.Type == "result" && v.ID == "unsub1":
// Unsubscribing MAY contain a pubsub element. But it does // Unsubscribing MAY contain a pubsub element. But it does