summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/matterbridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2020-04-19 01:06:44 +0200
committerGitHub <noreply@github.com>2020-04-19 01:06:44 +0200
commit2595dd30bf3eb014e2da1235b555f0cd88f6bf28 (patch)
tree464ed3a449ce4590804e8824c0efa9e3d76b8abe /vendor/github.com/matterbridge
parent9190365289f841f6764741d36d54bde0f8f2b623 (diff)
downloadmatterbridge-msglm-2595dd30bf3eb014e2da1235b555f0cd88f6bf28.tar.gz
matterbridge-msglm-2595dd30bf3eb014e2da1235b555f0cd88f6bf28.tar.bz2
matterbridge-msglm-2595dd30bf3eb014e2da1235b555f0cd88f6bf28.zip
Update matterbridge/go-xmpp. Fixes #1097 (#1099)
Diffstat (limited to 'vendor/github.com/matterbridge')
-rw-r--r--vendor/github.com/matterbridge/go-xmpp/xmpp.go143
1 files changed, 74 insertions, 69 deletions
diff --git a/vendor/github.com/matterbridge/go-xmpp/xmpp.go b/vendor/github.com/matterbridge/go-xmpp/xmpp.go
index 3d2f8bf9..56b08f5b 100644
--- a/vendor/github.com/matterbridge/go-xmpp/xmpp.go
+++ b/vendor/github.com/matterbridge/go-xmpp/xmpp.go
@@ -715,15 +715,46 @@ func (c *Client) Recv() (stanza interface{}, err error) {
}
case v.Type == "result":
switch v.ID {
+ case "sub1":
+ if v.Query.XMLName.Local == "pubsub" {
+ // Subscription or unsubscription was successful
+ var sub clientPubsubSubscription
+ err := xml.Unmarshal([]byte(v.Query.InnerXML), &sub)
+ if err != nil {
+ return PubsubSubscription{}, err
+ }
+
+ return PubsubSubscription{
+ SubID: sub.SubID,
+ JID: sub.JID,
+ Node: sub.Node,
+ Errors: nil,
+ }, nil
+ }
case "unsub1":
- // Unsubscribing MAY contain a pubsub element. But it does
- // not have to
- return PubsubUnsubscription{
- SubID: "",
- JID: v.From,
- Node: "",
- Errors: nil,
- }, nil
+ if v.Query.XMLName.Local == "pubsub" {
+ var sub clientPubsubSubscription
+ err := xml.Unmarshal([]byte(v.Query.InnerXML), &sub)
+ if err != nil {
+ return PubsubUnsubscription{}, err
+ }
+
+ return PubsubUnsubscription{
+ SubID: sub.SubID,
+ JID: v.From,
+ Node: sub.Node,
+ Errors: nil,
+ }, nil
+ } else {
+ // 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
@@ -750,56 +781,28 @@ func (c *Client) Recv() (stanza interface{}, err error) {
Identities: clientIdentitiesToReturn(disco.Identities),
}, nil
}
- }
- case v.Query.XMLName.Local == "pubsub":
- switch v.ID {
- case "sub1":
- // Subscription or unsubscription was successful
- var sub clientPubsubSubscription
- err := xml.Unmarshal([]byte(v.Query.InnerXML), &sub)
- if err != nil {
- return PubsubSubscription{}, err
- }
-
- return PubsubSubscription{
- SubID: sub.SubID,
- JID: sub.JID,
- Node: sub.Node,
- Errors: nil,
- }, nil
- case "unsub1":
- var sub clientPubsubSubscription
- err := xml.Unmarshal([]byte(v.Query.InnerXML), &sub)
- if err != nil {
- return PubsubUnsubscription{}, err
- }
-
- return PubsubUnsubscription{
- SubID: sub.SubID,
- JID: v.From,
- Node: sub.Node,
- Errors: nil,
- }, nil
case "items1", "items3":
- var p clientPubsubItems
- err := xml.Unmarshal([]byte(v.Query.InnerXML), &p)
- if err != nil {
- return PubsubItems{}, err
- }
+ if v.Query.XMLName.Local == "pubsub" {
+ var p clientPubsubItems
+ err := xml.Unmarshal([]byte(v.Query.InnerXML), &p)
+ if err != nil {
+ return PubsubItems{}, err
+ }
- switch p.Node {
- case XMPPNS_AVATAR_PEP_DATA:
- return handleAvatarData(p.Items[0].Body,
- v.From,
- p.Items[0].ID)
- case XMPPNS_AVATAR_PEP_METADATA:
- return handleAvatarMetadata(p.Items[0].Body,
- v.From)
- default:
- return PubsubItems{
- p.Node,
- pubsubItemsToReturn(p.Items),
- }, nil
+ switch p.Node {
+ case XMPPNS_AVATAR_PEP_DATA:
+ return handleAvatarData(p.Items[0].Body,
+ v.From,
+ p.Items[0].ID)
+ case XMPPNS_AVATAR_PEP_METADATA:
+ return handleAvatarMetadata(p.Items[0].Body,
+ v.From)
+ default:
+ return PubsubItems{
+ p.Node,
+ pubsubItemsToReturn(p.Items),
+ }, nil
+ }
}
// Note: XEP-0084 states that metadata and data
// should be fetched with an id of retrieve1.
@@ -807,20 +810,22 @@ func (c *Client) Recv() (stanza interface{}, err error) {
// can just use items1 and items3 to do the same
// as an Avatar node is just a PEP (PubSub) node.
/*case "retrieve1":
- var p clientPubsubItems
- err := xml.Unmarshal([]byte(v.Query.InnerXML), &p)
- if err != nil {
- return PubsubItems{}, err
- }
+ if v.Query.XMLName.Local == "pubsub" {
+ var p clientPubsubItems
+ err := xml.Unmarshal([]byte(v.Query.InnerXML), &p)
+ if err != nil {
+ return PubsubItems{}, err
+ }
- switch p.Node {
- case XMPPNS_AVATAR_PEP_DATA:
- return handleAvatarData(p.Items[0].Body,
- v.From,
- p.Items[0].ID)
- case XMPPNS_AVATAR_PEP_METADATA:
- return handleAvatarMetadata(p.Items[0].Body,
- v
+ switch p.Node {
+ case XMPPNS_AVATAR_PEP_DATA:
+ return handleAvatarData(p.Items[0].Body,
+ v.From,
+ p.Items[0].ID)
+ case XMPPNS_AVATAR_PEP_METADATA:
+ return handleAvatarMetadata(p.Items[0].Body,
+ v.From)
+ }
}*/
}
case v.Query.XMLName.Local == "":