--- a/pidgin/pidginaccounteditor.c Sat Oct 22 16:42:17 2022 -0500
+++ b/pidgin/pidginaccounteditor.c Sun Oct 23 01:23:16 2022 -0500
@@ -579,8 +579,11 @@
pidgin_account_editor_update_proxy_options(PidginAccountEditor *editor) {
PurpleProxyInfo *info = NULL;
GListModel *model = NULL;
- const gchar *svalue = NULL;
+ const char *type = "global"; + const char *hostname = NULL; + const char *username = NULL; + const char *password = NULL; if(!PURPLE_IS_ACCOUNT(editor->account)) {
@@ -588,62 +591,64 @@
info = purple_account_get_proxy_info(editor->account);
+ if(PURPLE_IS_PROXY_INFO(info)) { + switch(purple_proxy_info_get_proxy_type(info)) { + case PURPLE_PROXY_TYPE_USE_GLOBAL: + case PURPLE_PROXY_TYPE_NONE: + case PURPLE_PROXY_TYPE_SOCKS4: + case PURPLE_PROXY_TYPE_SOCKS5: + case PURPLE_PROXY_TYPE_TOR: + case PURPLE_PROXY_TYPE_HTTP: + case PURPLE_PROXY_TYPE_USE_ENVVAR: - switch(purple_proxy_info_get_proxy_type(info)) {
- case PURPLE_PROXY_TYPE_USE_GLOBAL:
- case PURPLE_PROXY_TYPE_NONE:
- case PURPLE_PROXY_TYPE_SOCKS4:
- case PURPLE_PROXY_TYPE_SOCKS5:
- case PURPLE_PROXY_TYPE_TOR:
- case PURPLE_PROXY_TYPE_HTTP:
- case PURPLE_PROXY_TYPE_USE_ENVVAR:
+ hostname = purple_proxy_info_get_hostname(info); + port = purple_proxy_info_get_port(info); + username = purple_proxy_info_get_username(info); + password = purple_proxy_info_get_password(info); model = adw_combo_row_get_model(ADW_COMBO_ROW(editor->proxy_type));
for(guint i = 0; i < g_list_model_get_n_items(model); i++) {
GtkStringObject *obj = g_list_model_get_item(model, i);
- if(purple_strequal(svalue, gtk_string_object_get_string(obj))) {
+ if(purple_strequal(type, gtk_string_object_get_string(obj))) { adw_combo_row_set_selected(ADW_COMBO_ROW(editor->proxy_type), position);
- svalue = purple_proxy_info_get_hostname(info);
- gtk_editable_set_text(GTK_EDITABLE(editor->proxy_host), svalue);
+ gtk_editable_set_text(GTK_EDITABLE(editor->proxy_host), hostname); - ivalue = purple_proxy_info_get_port(info);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(editor->proxy_port),
- svalue = purple_proxy_info_get_username(info);
- gtk_editable_set_text(GTK_EDITABLE(editor->proxy_username), svalue);
+ gtk_editable_set_text(GTK_EDITABLE(editor->proxy_username), username); - svalue = purple_proxy_info_get_password(info);
- gtk_editable_set_text(GTK_EDITABLE(editor->proxy_password), svalue);
+ gtk_editable_set_text(GTK_EDITABLE(editor->proxy_password), password); @@ -872,11 +877,16 @@
/* Build the ProxyInfo object */
+ info = purple_account_get_proxy_info(editor->account); + /* If this is a new account, or the account's proxy info is null, create a + * new instance, and set it on the account. + if(new_account || !PURPLE_IS_PROXY_INFO(info)) { info = purple_proxy_info_new();
purple_account_set_proxy_info(editor->account, info);
- info = purple_account_get_proxy_info(editor->account);
item = adw_combo_row_get_selected_item(ADW_COMBO_ROW(editor->proxy_type));