summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/matterbridge/go-xmpp/xmpp.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-04-18 20:58:55 +0200
committerGitHub <noreply@github.com>2020-04-18 20:58:55 +0200
commit8a87a71927d8560ccd993a986be4e7eb34ad46da (patch)
tree52ca770695db4b0f220d31b17a1835b58929d94d /vendor/github.com/matterbridge/go-xmpp/xmpp.go
parent0047e6f52370d4581c53276e67828b075091ead8 (diff)
downloadmatterbridge-msglm-8a87a71927d8560ccd993a986be4e7eb34ad46da.tar.gz
matterbridge-msglm-8a87a71927d8560ccd993a986be4e7eb34ad46da.tar.bz2
matterbridge-msglm-8a87a71927d8560ccd993a986be4e7eb34ad46da.zip
Update matterbridge/go-xmpp to add PEP-0030 support (#1095)
Diffstat (limited to 'vendor/github.com/matterbridge/go-xmpp/xmpp.go')
-rw-r--r--vendor/github.com/matterbridge/go-xmpp/xmpp.go49
1 files changed, 40 insertions, 9 deletions
diff --git a/vendor/github.com/matterbridge/go-xmpp/xmpp.go b/vendor/github.com/matterbridge/go-xmpp/xmpp.go
index bb1438e9..3d2f8bf9 100644
--- a/vendor/github.com/matterbridge/go-xmpp/xmpp.go
+++ b/vendor/github.com/matterbridge/go-xmpp/xmpp.go
@@ -713,15 +713,44 @@ func (c *Client) Recv() (stanza interface{}, err error) {
Errors: errsStr,
}, nil
}
- case v.Type == "result" && v.ID == "unsub1":
- // Unsubscribing MAY contain a pubsub element. But it does
- // not have to
- return PubsubUnsubscription{
- SubID: "",
- JID: v.From,
- Node: "",
- Errors: nil,
- }, nil
+ case v.Type == "result":
+ switch v.ID {
+ case "unsub1":
+ // Unsubscribing MAY contain a pubsub element. But it does
+ // not have to
+ return PubsubUnsubscription{
+ SubID: "",
+ JID: v.From,
+ Node: "",
+ Errors: nil,
+ }, nil
+ case "info1":
+ if v.Query.XMLName.Space == XMPPNS_DISCO_ITEMS {
+ var itemsQuery clientDiscoItemsQuery
+ err := xml.Unmarshal(v.InnerXML, &itemsQuery)
+ if err != nil {
+ return []DiscoItem{}, err
+ }
+
+ return DiscoItems{
+ Jid: v.From,
+ Items: clientDiscoItemsToReturn(itemsQuery.Items),
+ }, nil
+ }
+ case "info3":
+ if v.Query.XMLName.Space == XMPPNS_DISCO_INFO {
+ var disco clientDiscoQuery
+ err := xml.Unmarshal(v.InnerXML, &disco)
+ if err != nil {
+ return DiscoResult{}, err
+ }
+
+ return DiscoResult{
+ Features: clientFeaturesToReturn(disco.Features),
+ Identities: clientIdentitiesToReturn(disco.Identities),
+ }, nil
+ }
+ }
case v.Query.XMLName.Local == "pubsub":
switch v.ID {
case "sub1":
@@ -1049,6 +1078,8 @@ type clientIQ struct {
Query XMLElement `xml:",any"`
Error clientError
Bind bindBind
+
+ InnerXML []byte `xml:",innerxml"`
}
type clientError struct {