Update matterbridge/go-xmpp. Fixes #1097 (#1099)

This commit is contained in:
Wim 2020-04-19 01:06:44 +02:00 committed by GitHub
parent 9190365289
commit 2595dd30bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 78 additions and 73 deletions

2
go.mod
View File

@ -24,7 +24,7 @@ require (
github.com/matterbridge/Rocket.Chat.Go.SDK v0.0.0-20200411204219-d5c18ce75048 github.com/matterbridge/Rocket.Chat.Go.SDK v0.0.0-20200411204219-d5c18ce75048
github.com/matterbridge/discordgo v0.18.1-0.20200308151012-aa40f01cbcc3 github.com/matterbridge/discordgo v0.18.1-0.20200308151012-aa40f01cbcc3
github.com/matterbridge/emoji v2.1.1-0.20191117213217-af507f6b02db+incompatible github.com/matterbridge/emoji v2.1.1-0.20191117213217-af507f6b02db+incompatible
github.com/matterbridge/go-xmpp v0.0.0-20200418162626-e69b0b8696ef github.com/matterbridge/go-xmpp v0.0.0-20200418225040-c8a3a57b4050
github.com/matterbridge/gomatrix v0.0.0-20200209224845-c2104d7936a6 github.com/matterbridge/gomatrix v0.0.0-20200209224845-c2104d7936a6
github.com/matterbridge/gozulipbot v0.0.0-20190212232658-7aa251978a18 github.com/matterbridge/gozulipbot v0.0.0-20190212232658-7aa251978a18
github.com/matterbridge/logrus-prefixed-formatter v0.0.0-20180806162718-01618749af61 github.com/matterbridge/logrus-prefixed-formatter v0.0.0-20180806162718-01618749af61

4
go.sum
View File

@ -130,8 +130,8 @@ github.com/matterbridge/discordgo v0.18.1-0.20200308151012-aa40f01cbcc3 h1:VP/DN
github.com/matterbridge/discordgo v0.18.1-0.20200308151012-aa40f01cbcc3/go.mod h1:5a1bHtG/38ofcx9cgwM5eTW/Pl4SpbQksNDnTRcGA2Y= github.com/matterbridge/discordgo v0.18.1-0.20200308151012-aa40f01cbcc3/go.mod h1:5a1bHtG/38ofcx9cgwM5eTW/Pl4SpbQksNDnTRcGA2Y=
github.com/matterbridge/emoji v2.1.1-0.20191117213217-af507f6b02db+incompatible h1:oaOqwbg5HxHRxvAbd84ks0Okwoc1ISyUZ87EiVJFhGI= github.com/matterbridge/emoji v2.1.1-0.20191117213217-af507f6b02db+incompatible h1:oaOqwbg5HxHRxvAbd84ks0Okwoc1ISyUZ87EiVJFhGI=
github.com/matterbridge/emoji v2.1.1-0.20191117213217-af507f6b02db+incompatible/go.mod h1:igE6rUAn3jai2wCdsjFHfhUoekjrFthoEjFObKKwSb4= github.com/matterbridge/emoji v2.1.1-0.20191117213217-af507f6b02db+incompatible/go.mod h1:igE6rUAn3jai2wCdsjFHfhUoekjrFthoEjFObKKwSb4=
github.com/matterbridge/go-xmpp v0.0.0-20200418162626-e69b0b8696ef h1:CDIIh3ZViXddwWh9vctOmOOQPXhWeuHdGnwNkPc5JtE= github.com/matterbridge/go-xmpp v0.0.0-20200418225040-c8a3a57b4050 h1:kWkP1lXpkvtoNL08jkP3XQH/zvDOEXJpdCJd/DlIvMw=
github.com/matterbridge/go-xmpp v0.0.0-20200418162626-e69b0b8696ef/go.mod h1:ECDRehsR9TYTKCAsRS8/wLeOk6UUqDydw47ln7wG41Q= github.com/matterbridge/go-xmpp v0.0.0-20200418225040-c8a3a57b4050/go.mod h1:ECDRehsR9TYTKCAsRS8/wLeOk6UUqDydw47ln7wG41Q=
github.com/matterbridge/gomatrix v0.0.0-20200209224845-c2104d7936a6 h1:Kl65VJv38HjYFnnwH+MP6Z8hcJT5UHuSpHVU5vW1HH0= github.com/matterbridge/gomatrix v0.0.0-20200209224845-c2104d7936a6 h1:Kl65VJv38HjYFnnwH+MP6Z8hcJT5UHuSpHVU5vW1HH0=
github.com/matterbridge/gomatrix v0.0.0-20200209224845-c2104d7936a6/go.mod h1:+jWeaaUtXQbBRdKYWfjW6JDDYiI2XXE+3NnTjW5kg8g= github.com/matterbridge/gomatrix v0.0.0-20200209224845-c2104d7936a6/go.mod h1:+jWeaaUtXQbBRdKYWfjW6JDDYiI2XXE+3NnTjW5kg8g=
github.com/matterbridge/gozulipbot v0.0.0-20190212232658-7aa251978a18 h1:fLhwXtWGtfTgZVxHG1lcKjv+re7dRwyyuYFNu69xdho= github.com/matterbridge/gozulipbot v0.0.0-20190212232658-7aa251978a18 h1:fLhwXtWGtfTgZVxHG1lcKjv+re7dRwyyuYFNu69xdho=

View File

@ -715,15 +715,46 @@ func (c *Client) Recv() (stanza interface{}, err error) {
} }
case v.Type == "result": case v.Type == "result":
switch v.ID { 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": case "unsub1":
// Unsubscribing MAY contain a pubsub element. But it does if v.Query.XMLName.Local == "pubsub" {
// not have to var sub clientPubsubSubscription
return PubsubUnsubscription{ err := xml.Unmarshal([]byte(v.Query.InnerXML), &sub)
SubID: "", if err != nil {
JID: v.From, return PubsubUnsubscription{}, err
Node: "", }
Errors: nil,
}, nil 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": case "info1":
if v.Query.XMLName.Space == XMPPNS_DISCO_ITEMS { if v.Query.XMLName.Space == XMPPNS_DISCO_ITEMS {
var itemsQuery clientDiscoItemsQuery var itemsQuery clientDiscoItemsQuery
@ -750,56 +781,28 @@ func (c *Client) Recv() (stanza interface{}, err error) {
Identities: clientIdentitiesToReturn(disco.Identities), Identities: clientIdentitiesToReturn(disco.Identities),
}, nil }, 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": case "items1", "items3":
var p clientPubsubItems if v.Query.XMLName.Local == "pubsub" {
err := xml.Unmarshal([]byte(v.Query.InnerXML), &p) var p clientPubsubItems
if err != nil { err := xml.Unmarshal([]byte(v.Query.InnerXML), &p)
return PubsubItems{}, err if err != nil {
} return PubsubItems{}, err
}
switch p.Node { switch p.Node {
case XMPPNS_AVATAR_PEP_DATA: case XMPPNS_AVATAR_PEP_DATA:
return handleAvatarData(p.Items[0].Body, return handleAvatarData(p.Items[0].Body,
v.From, v.From,
p.Items[0].ID) p.Items[0].ID)
case XMPPNS_AVATAR_PEP_METADATA: case XMPPNS_AVATAR_PEP_METADATA:
return handleAvatarMetadata(p.Items[0].Body, return handleAvatarMetadata(p.Items[0].Body,
v.From) v.From)
default: default:
return PubsubItems{ return PubsubItems{
p.Node, p.Node,
pubsubItemsToReturn(p.Items), pubsubItemsToReturn(p.Items),
}, nil }, nil
}
} }
// Note: XEP-0084 states that metadata and data // Note: XEP-0084 states that metadata and data
// should be fetched with an id of retrieve1. // 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 // can just use items1 and items3 to do the same
// as an Avatar node is just a PEP (PubSub) node. // as an Avatar node is just a PEP (PubSub) node.
/*case "retrieve1": /*case "retrieve1":
var p clientPubsubItems if v.Query.XMLName.Local == "pubsub" {
err := xml.Unmarshal([]byte(v.Query.InnerXML), &p) var p clientPubsubItems
if err != nil { err := xml.Unmarshal([]byte(v.Query.InnerXML), &p)
return PubsubItems{}, err if err != nil {
} return PubsubItems{}, err
}
switch p.Node { switch p.Node {
case XMPPNS_AVATAR_PEP_DATA: case XMPPNS_AVATAR_PEP_DATA:
return handleAvatarData(p.Items[0].Body, return handleAvatarData(p.Items[0].Body,
v.From, v.From,
p.Items[0].ID) p.Items[0].ID)
case XMPPNS_AVATAR_PEP_METADATA: case XMPPNS_AVATAR_PEP_METADATA:
return handleAvatarMetadata(p.Items[0].Body, return handleAvatarMetadata(p.Items[0].Body,
v v.From)
}
}*/ }*/
} }
case v.Query.XMLName.Local == "": case v.Query.XMLName.Local == "":

2
vendor/modules.txt vendored
View File

@ -103,7 +103,7 @@ github.com/matterbridge/Rocket.Chat.Go.SDK/rest
github.com/matterbridge/discordgo github.com/matterbridge/discordgo
# github.com/matterbridge/emoji v2.1.1-0.20191117213217-af507f6b02db+incompatible # github.com/matterbridge/emoji v2.1.1-0.20191117213217-af507f6b02db+incompatible
github.com/matterbridge/emoji github.com/matterbridge/emoji
# github.com/matterbridge/go-xmpp v0.0.0-20200418162626-e69b0b8696ef # github.com/matterbridge/go-xmpp v0.0.0-20200418225040-c8a3a57b4050
github.com/matterbridge/go-xmpp github.com/matterbridge/go-xmpp
# github.com/matterbridge/gomatrix v0.0.0-20200209224845-c2104d7936a6 # github.com/matterbridge/gomatrix v0.0.0-20200209224845-c2104d7936a6
github.com/matterbridge/gomatrix github.com/matterbridge/gomatrix