Mon, 15 Aug 2022 21:30:26 -0500
Fix the add account button in Finch by removing passwords from it.
Testing Done:
Ran Finch and verified that the `Add` button in the `Accounts` dialog opened the account editor.
Reviewed at https://reviews.imfreedom.org/r/1593/
| finch/gntaccount.c | file | annotate | diff | comparison | revisions |
--- a/finch/gntaccount.c Mon Aug 15 21:28:59 2022 -0500 +++ b/finch/gntaccount.c Mon Aug 15 21:30:26 2022 -0500 @@ -48,7 +48,6 @@ GntWidget *protocol; GntWidget *username; - GntWidget *password; GntWidget *alias; GntWidget *splits; @@ -89,15 +88,12 @@ save_account_cb(AccountEditDialog *dialog) { PurpleAccount *account; - PurpleCredentialManager *manager = NULL; PurpleProtocol *protocol; const char *value; GString *username; /* XXX: Do some error checking first. */ - manager = purple_credential_manager_get_default(); - protocol = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(dialog->protocol)); /* Username && user-splits */ @@ -189,14 +185,6 @@ /* Remember password and password */ purple_account_set_remember_password(account, gnt_check_box_get_checked(GNT_CHECK_BOX(dialog->remember))); - value = gnt_entry_get_text(GNT_ENTRY(dialog->password)); - if (value && *value) { - purple_credential_manager_write_password_async(manager, account, value, - NULL, NULL, NULL); - } else { - purple_credential_manager_clear_password_async(manager, account, NULL, - NULL, NULL); - } /* Protocol options */ if (protocol) @@ -520,20 +508,14 @@ } static void -edit_account_continue(GObject *obj, GAsyncResult *res, gpointer data) +edit_account(PurpleAccount *account) { - PurpleAccount *account = PURPLE_ACCOUNT(data); - PurpleCredentialManager *manager = PURPLE_CREDENTIAL_MANAGER(obj); GntWidget *window, *hbox; GntWidget *combo, *button, *entry; GList *list, *iter; AccountEditDialog *dialog; PurpleProtocol *protocol; PurpleProtocolManager *protocol_manager = NULL; - gchar *password = NULL; - - password = purple_credential_manager_read_password_finish(manager, res, - NULL); if (account) { @@ -607,18 +589,6 @@ gnt_box_set_pad(GNT_BOX(hbox), 0); gnt_box_add_widget(GNT_BOX(window), hbox); - dialog->password = entry = gnt_entry_new(NULL); - gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); - gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Password:"))); - gnt_box_add_widget(GNT_BOX(hbox), entry); - if (account) { - gnt_entry_set_text(GNT_ENTRY(entry), password); - } - - hbox = gnt_hbox_new(TRUE); - gnt_box_set_pad(GNT_BOX(hbox), 0); - gnt_box_add_widget(GNT_BOX(window), hbox); - dialog->alias = entry = gnt_entry_new(NULL); gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Alias:"))); gnt_box_add_widget(GNT_BOX(hbox), entry); @@ -660,22 +630,10 @@ gnt_box_readjust(GNT_BOX(window)); gnt_widget_draw(window); - g_free(password); g_list_free(list); } static void -edit_account(PurpleAccount *account) -{ - PurpleCredentialManager *manager = NULL; - - manager = purple_credential_manager_get_default(); - purple_credential_manager_read_password_async(manager, account, NULL, - edit_account_continue, - account); -} - -static void add_account_cb(GntWidget *widget, gpointer null) { edit_account(NULL);