Fix handling contact messages

This commit is contained in:
Tulir Asokan 2020-07-16 21:08:00 +03:00
parent f3728024b0
commit 9ac7544b64

View file

@ -676,6 +676,9 @@ func (user *User) putMessage(message PortalMessage) {
func (user *User) HandleNewContact(contact whatsapp.Contact) { func (user *User) HandleNewContact(contact whatsapp.Contact) {
user.log.Debugfln("Contact message: %+v", contact) user.log.Debugfln("Contact message: %+v", contact)
go func() { go func() {
if strings.HasSuffix(contact.Jid, whatsappExt.OldUserSuffix) {
contact.Jid = strings.Replace(contact.Jid, whatsappExt.OldUserSuffix, whatsappExt.NewUserSuffix, -1)
}
puppet := user.bridge.GetPuppetByJID(contact.Jid) puppet := user.bridge.GetPuppetByJID(contact.Jid)
puppet.UpdateName(user, contact) puppet.UpdateName(user, contact)
}() }()