forked from jshiffer/matterbridge
Fetch avatars synchronous (whatsapp)
This commit is contained in:
parent
0205a67309
commit
1b9877fda4
@ -28,6 +28,8 @@ func (b *Bwhatsapp) handleMessage(message *events.Message) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b.Log.Infof("Receiving message %#v", msg)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case msg.Conversation != nil || msg.ExtendedTextMessage != nil:
|
case msg.Conversation != nil || msg.ExtendedTextMessage != nil:
|
||||||
b.handleTextMessage(message.Info, msg)
|
b.handleTextMessage(message.Info, msg)
|
||||||
|
@ -113,22 +113,22 @@ func (b *Bwhatsapp) Connect() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get user avatar asynchronously
|
// get user avatar asynchronously
|
||||||
go func() {
|
// go func() {
|
||||||
b.Log.Debug("Getting user avatars..")
|
b.Log.Info("Getting user avatars..")
|
||||||
|
|
||||||
for jid := range b.users {
|
for jid := range b.users {
|
||||||
info, err := b.GetProfilePicThumb(jid)
|
info, err := b.GetProfilePicThumb(jid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Log.Warnf("Could not get profile photo of %s: %v", jid, err)
|
b.Log.Warnf("Could not get profile photo of %s: %v", jid, err)
|
||||||
} else {
|
} else {
|
||||||
b.Lock()
|
b.Lock()
|
||||||
b.userAvatars[jid] = info.URL
|
b.userAvatars[jid] = info.URL
|
||||||
b.Unlock()
|
b.Unlock()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
b.Log.Debug("Finished getting avatars..")
|
b.Log.Info("Finished getting avatars..")
|
||||||
}()
|
// }()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user