1
0
Fork 0
mirror of https://github.com/mautrix/whatsapp.git synced 2026-05-14 17:56:53 -04:00

Compare commits

...

1 commit

Author SHA1 Message Date
Nick Mills-Barrett
c29d5632bb
Fetch contact name after login
Not sure this is the correct way to do this.
2025-04-15 12:14:02 +01:00

View file

@ -322,6 +322,15 @@ func (wl *WALogin) Wait(ctx context.Context) (*bridgev2.LoginStep, error) {
ul.Client.(*WhatsAppClient).isNewLogin = true
ul.Client.Connect(ul.Log.WithContext(context.Background()))
if contact, err := ul.Client.(*WhatsAppClient).GetStore().Contacts.GetContact(wl.LoginSuccess.ID); err != nil {
wl.Log.Err(err).Msg("Failed to get own contact after login")
} else {
contactInfo := ul.Client.(*WhatsAppClient).contactToUserInfo(ctx, wl.LoginSuccess.ID, contact, true)
if contactInfo.Name != nil {
ul.UserLogin.RemoteProfile.Username = *contactInfo.Name
}
}
return &bridgev2.LoginStep{
Type: bridgev2.LoginStepTypeComplete,
StepID: LoginStepIDComplete,