Fix issues with go-xmpp

This commit is contained in:
Alexander PapaTutuWawa
2020-04-18 21:43:39 +02:00
parent 3c8928e305
commit 38f4588346
2 changed files with 12 additions and 11 deletions

View File

@@ -32,3 +32,13 @@ func (b *Bxmpp) handleDownloadAvatar(avatar xmpp.AvatarData) {
b.Remote <- rmsg
}
}
func (b *Bxmpp) handleDisco(items xmpp.DiscoItems) {
if discoSupportsAvatar(items.Items) {
b.Log.Debugf("%s supports avatars", items.Jid)
b.avatarAvailability[items.Jid] = avatarAvailable
} else {
b.Log.Debugf("%s does not support avatars", items.Jid)
b.avatarAvailability[items.Jid] = avatarUnavailable
}
}

View File

@@ -1,6 +1,7 @@
package bxmpp
import (
"fmt"
"regexp"
"github.com/42wim/matterbridge/bridge/config"
@@ -30,7 +31,7 @@ func (b *Bxmpp) cacheAvatar(msg *config.Message) string {
return ""
}
func discoSupportsAvatar(items []*xmpp.DiscoItems) bool {
func discoSupportsAvatar(items []xmpp.DiscoItem) bool {
for _, item := range items {
if item.Node == xmpp.XMPPNS_AVATAR_PEP_DATA {
return true
@@ -39,13 +40,3 @@ func discoSupportsAvatar(items []*xmpp.DiscoItems) bool {
return false
}
func (b *Bxmpp) handleDisco(items xmpp.DiscoItems) {
if discoSupportsAvatar(items) {
b.Log.Debugf("%s supports avatars", items.Jid)
b.avatarAvailability[items.Jid] = avatarAvailable
} else {
b.Log.Debugf("%s does not support avatars", items.Jid)
b.avatarAvailability[items.Jid] = avatarUnavailable
}
}