diff --git a/bridge/xmpp/handler.go b/bridge/xmpp/handler.go index 731998d9..9d05df8c 100644 --- a/bridge/xmpp/handler.go +++ b/bridge/xmpp/handler.go @@ -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 + } +} diff --git a/bridge/xmpp/helpers.go b/bridge/xmpp/helpers.go index 28f0e65a..a7114444 100644 --- a/bridge/xmpp/helpers.go +++ b/bridge/xmpp/helpers.go @@ -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 - } -}