5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-09-19 15:49:36 +00:00

Fetch avatars synchronous (whatsapp)

This commit is contained in:
Wim 2022-02-04 00:33:50 +01:00
parent 0205a67309
commit 1b9877fda4
2 changed files with 15 additions and 13 deletions

View File

@ -28,6 +28,8 @@ func (b *Bwhatsapp) handleMessage(message *events.Message) {
return
}
b.Log.Infof("Receiving message %#v", msg)
switch {
case msg.Conversation != nil || msg.ExtendedTextMessage != nil:
b.handleTextMessage(message.Info, msg)

View File

@ -113,22 +113,22 @@ func (b *Bwhatsapp) Connect() error {
}
// get user avatar asynchronously
go func() {
b.Log.Debug("Getting user avatars..")
// go func() {
b.Log.Info("Getting user avatars..")
for jid := range b.users {
info, err := b.GetProfilePicThumb(jid)
if err != nil {
b.Log.Warnf("Could not get profile photo of %s: %v", jid, err)
} else {
b.Lock()
b.userAvatars[jid] = info.URL
b.Unlock()
}
for jid := range b.users {
info, err := b.GetProfilePicThumb(jid)
if err != nil {
b.Log.Warnf("Could not get profile photo of %s: %v", jid, err)
} else {
b.Lock()
b.userAvatars[jid] = info.URL
b.Unlock()
}
}
b.Log.Debug("Finished getting avatars..")
}()
b.Log.Info("Finished getting avatars..")
// }()
return nil
}