pidgin/pidgin

51941cbd4306
Parents c8555ca0fe5e
Children b481323d02d5
Remove purple_connection_ssl_error and PurpleSslErrorType

These were only used in XMPP so I just inlined them there.

Testing Done:
Connected an xmpp account that uses tls.

Reviewed at https://reviews.imfreedom.org/r/1802/
--- a/ChangeLog.API Mon Sep 19 23:59:49 2022 -0500
+++ b/ChangeLog.API Tue Sep 20 00:44:31 2022 -0500
@@ -405,6 +405,7 @@
* purple_connection_new_unregister
* purple_connection_destroy
* purple_connection_set_account
+ * purple_connection_ssl_error
* PurpleConnectionUiOps->connect_progress
* purple_connection_update_progress
* purple_connections_get_connecting
@@ -666,6 +667,7 @@
* purple_srv_cancel
* purple_srv_resolve_account
* purple_srv_txt_query_destroy
+ * PurpleSslErrorType
* purple_str_add_cr
* purple_strcasereplace
* PurpleStunNatType
--- a/libpurple/connection.c Mon Sep 19 23:59:49 2022 -0500
+++ b/libpurple/connection.c Tue Sep 20 00:44:31 2022 -0500
@@ -426,36 +426,6 @@
}
void
-purple_connection_ssl_error(PurpleConnection *gc,
- PurpleSslErrorType ssl_error)
-{
- PurpleConnectionError reason;
- const gchar *message;
-
- switch (ssl_error) {
- case PURPLE_SSL_HANDSHAKE_FAILED:
- message = _("SSL Handshake Failed");
- reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR;
- break;
- case PURPLE_SSL_CONNECT_FAILED:
- message = _("SSL Connection Failed");
- reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
- break;
- case PURPLE_SSL_CERTIFICATE_INVALID:
- /* TODO: maybe PURPLE_SSL_* should be more specific? */
- message = _("SSL peer presented an invalid certificate");
- reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR;
- break;
- default:
- g_assert_not_reached ();
- message = _("Unknown SSL error");
- reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR;
- }
-
- purple_connection_error(gc, reason, message);
-}
-
-void
purple_connection_g_error(PurpleConnection *pc, const GError *error) {
PurpleConnectionError reason;
--- a/libpurple/connection.h Mon Sep 19 23:59:49 2022 -0500
+++ b/libpurple/connection.h Tue Sep 20 00:44:31 2022 -0500
@@ -195,21 +195,6 @@
char *description;
};
-/**
- * PurpleSslErrorType:
- * @PURPLE_SSL_HANDSHAKE_FAILED: The handshake failed
- * @PURPLE_SSL_CONNECT_FAILED: The connection failed
- * @PURPLE_SSL_CERTIFICATE_INVALID: The certificated is invalid
- *
- * Possible SSL errors.
- */
-typedef enum
-{
- PURPLE_SSL_HANDSHAKE_FAILED = 1,
- PURPLE_SSL_CONNECT_FAILED = 2,
- PURPLE_SSL_CERTIFICATE_INVALID = 3
-} PurpleSslErrorType;
-
#include <time.h>
#include "account.h"
@@ -496,19 +481,6 @@
PurpleConnectionErrorInfo *
purple_connection_get_error_info(PurpleConnection *gc);
-/**
- * purple_connection_ssl_error:
- * @gc: The connection.
- * @ssl_error: The SSL error type.
- *
- * Closes a connection due to an SSL error; this is basically a shortcut to
- * turning the #PurpleSslErrorType into a #PurpleConnectionError and a
- * human-readable string and then calling purple_connection_error().
- */
-void
-purple_connection_ssl_error (PurpleConnection *gc,
- PurpleSslErrorType ssl_error);
-
/*
* purple_connection_g_error
* @gc: Connection the error is associated with
--- a/libpurple/protocols/jabber/jabber.c Mon Sep 19 23:59:49 2022 -0500
+++ b/libpurple/protocols/jabber/jabber.c Tue Sep 20 00:44:31 2022 -0500
@@ -731,10 +731,14 @@
/* Connection already closed/freed. Escape. */
} else if (g_error_matches(error, G_TLS_ERROR, G_TLS_ERROR_HANDSHAKE)) {
/* In Gio, a handshake error is because of the cert */
- purple_connection_ssl_error(js->gc, PURPLE_SSL_CERTIFICATE_INVALID);
+ purple_connection_error(js->gc,
+ PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR,
+ _("SSL peer presented an invalid certificate"));
} else {
/* Report any other errors as handshake failing */
- purple_connection_ssl_error(js->gc, PURPLE_SSL_HANDSHAKE_FAILED);
+ purple_connection_error(js->gc,
+ PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR,
+ _("SSL Handshake Failed"));
}
g_error_free(error);
@@ -770,7 +774,8 @@
"Error creating TLS client connection: %s",
error->message);
g_clear_error(&error);
- purple_connection_ssl_error(js->gc, PURPLE_SSL_CONNECT_FAILED);
+ purple_connection_error(js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
+ _("SSL Connection Failed"));
return;
}