Mon, 14 Oct 2024 22:58:04 -0500
Update the protocols now that Purple.Account:error is a GLib.Error
Testing Done:
Reaped a connection with the demo protocol plugin and called in the turtles.
Bugs closed: PIDGIN-17985
Reviewed at https://reviews.imfreedom.org/r/3577/
--- a/protocols/demo/purpledemoprotocolactions.c Mon Oct 14 22:56:26 2024 -0500 +++ b/protocols/demo/purpledemoprotocolactions.c Mon Oct 14 22:58:04 2024 -0500 @@ -42,9 +42,8 @@ const char *disconnect_str) { PurpleConnection *connection = PURPLE_CONNECTION(data); - PurpleConnectionErrorInfo *error_info = NULL; PurpleAccount *account = purple_connection_get_account(connection); - char *message = NULL; + GError *error = NULL; int timeout = 0; timeout = GPOINTER_TO_INT(g_object_steal_data(G_OBJECT(connection), @@ -64,6 +63,7 @@ if(PURPLE_IS_CONTACT(contact)) { PurpleContactInfo *info = PURPLE_CONTACT_INFO(contact); PurplePresence *presence = purple_contact_info_get_presence(info); + char *message = NULL; const char *format = ngettext(tick_str, tick_plural_str, timeout); message = g_strdup_printf(format, timeout); @@ -74,12 +74,9 @@ return G_SOURCE_CONTINUE; } - message = g_strdup_printf(_(disconnect_str), REAPER_BUDDY_NAME); - error_info = purple_connection_error_info_new(error_code, message); - g_free(message); - - purple_account_set_error_info(account, error_info); - purple_account_disconnect(account); + error = g_error_new(PURPLE_CONNECTION_ERROR, error_code, _(disconnect_str), + REAPER_BUDDY_NAME); + purple_account_disconnect_with_error(account, error); return G_SOURCE_REMOVE; }
--- a/protocols/ircv3/purpleircv3connection.c Mon Oct 14 22:56:26 2024 -0500 +++ b/protocols/ircv3/purpleircv3connection.c Mon Oct 14 22:58:04 2024 -0500 @@ -552,12 +552,8 @@ error = ibis_client_get_error(client); if(error != NULL) { PurpleAccount *account = purple_connection_get_account(connection); - PurpleConnectionErrorInfo *error_info = NULL; - error_info = purple_connection_error_info_new(PURPLE_CONNECTION_ERROR_OTHER_ERROR, - error->message); - purple_account_set_error_info(account, error_info); - purple_account_disconnect(account); + purple_account_disconnect_with_error(account, error); } }
--- a/protocols/xmpp/purplexmppconnection.c Mon Oct 14 22:56:26 2024 -0500 +++ b/protocols/xmpp/purplexmppconnection.c Mon Oct 14 22:58:04 2024 -0500 @@ -50,13 +50,10 @@ &error); if(error != NULL) { PurpleAccount *account = NULL; - PurpleConnectionErrorInfo *error_info = NULL; account = purple_connection_get_account(PURPLE_CONNECTION(connection)); - error_info = purple_connection_error_info_new(PURPLE_CONNECTION_ERROR_OTHER_ERROR, - error->message); - purple_account_set_error_info(account, error_info); - purple_account_disconnect(account); + + purple_account_disconnect_with_error(account, error); return; }