From 38f458834648182074f7785a73ce9bb5219b2e52 Mon Sep 17 00:00:00 2001 From: Alexander PapaTutuWawa Date: Sat, 18 Apr 2020 21:43:39 +0200 Subject: [PATCH] Fix issues with go-xmpp --- bridge/xmpp/handler.go | 10 ++++++++++ bridge/xmpp/helpers.go | 13 ++----------- 2 files changed, 12 insertions(+), 11 deletions(-) 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 - } -}