Skip to content

Commit

Permalink
Purple username must now match master device JID.
Browse files Browse the repository at this point in the history
  • Loading branch information
hoehermann committed Mar 12, 2023
1 parent 010f690 commit f3bac71
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,8 @@ For sending opus in ogg audio files as voice messages, add a static win32 build
#### Set-Up

* Create a new account
You can enter an arbitrary username.
It is recommended to use your own internationalized number, followed by `@s.whatsapp.net`.
Example: `123456789` from Germany would use `[email protected]`.
This way, you *recognize yourself in group chats* and Pidgin's logs look sane.
You must enter your phone's internationalized number followed by `@s.whatsapp.net`.
Example: `123456789` from Germany would use `[email protected]`.

* Upon login, a QR code is shown in a Pidgin request window.
Using your phone's camera, scan the code within 20 seconds – just like you would do with WhatsApp Web.
Expand Down
1 change: 1 addition & 0 deletions src/c/groups.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ gowhatsapp_enter_group_chat(PurpleConnection *pc, const char *remoteJid, char **
// store the JID so it can be retrieved by get_chat_name
purple_conversation_set_data(conv, "name", g_strdup(remoteJid)); // MEMCHECK: this leaks, but there is no mechanism to stop it
PurpleConvChat *conv_chat = purple_conversation_get_chat_data(conv);
purple_conv_chat_set_nick(conv_chat, purple_account_get_username(account));
if (participants == NULL) {
// list of participants is empty, request it explicitly and release it immediately
char **participants = gowhatsapp_go_query_group_participants(account, (char *)remoteJid);
Expand Down
4 changes: 3 additions & 1 deletion src/go/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ func (handler *Handler) eventHandler(rawEvt interface{}) {
log.Infof("PairSuccess: %#v", evt)
log.Infof("client.Store: %#v", cli.Store)
if cli.Store.ID == nil {
purple_error(handler.account, fmt.Sprintf("Pairing succeded, but device ID is missing."), ERROR_FATAL)
purple_error(handler.account, "Pairing succeded, but device ID is missing.", ERROR_FATAL)
} else if evt.ID.ToNonAD().String() != handler.username {
purple_error(handler.account, fmt.Sprintf("Your username '%s' does not match the main device's ID '%s'. Please adjust your username.", handler.username, evt.ID.ToNonAD().String()), ERROR_FATAL)
} else {
set_credentials(handler.account, *cli.Store.ID, cli.Store.RegistrationID)
purple_pairing_succeeded(handler.account)
Expand Down
2 changes: 2 additions & 0 deletions src/go/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ func login(account *PurpleAccount, purple_user_dir string, username string, cred
device = container.NewDevice()
// device.RegistrationID has been generated. sync it and continue (see next if below)
registrationId = device.RegistrationID
} else if device.ID.ToNonAD().String() != username {
purple_error(account, fmt.Sprintf("Your username '%s' does not match the main device's ID '%s'. Please adjust your username.", username, device.ID.ToNonAD().String()), ERROR_FATAL)
}

// check user-supplied registration id against the one stored in the device
Expand Down

0 comments on commit f3bac71

Please sign in to comment.