Browse Source

Fix handling contact messages

Tulir Asokan 5 years ago
parent
commit
9ac7544b64
1 changed files with 3 additions and 0 deletions
  1. 3 0
      user.go

+ 3 - 0
user.go

@@ -676,6 +676,9 @@ func (user *User) putMessage(message PortalMessage) {
 func (user *User) HandleNewContact(contact whatsapp.Contact) {
 	user.log.Debugfln("Contact message: %+v", contact)
 	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.UpdateName(user, contact)
 	}()