--- a/libpurple/connection.c Wed Sep 19 11:39:42 2007 +0000
+++ b/libpurple/connection.c Wed Sep 19 15:00:48 2007 +0000
@@ -525,6 +525,29 @@
purple_connection_get_account(gc));
+purple_connection_ssl_error (PurpleConnection *gc, + PurpleSslErrorType ssl_error) + PurpleDisconnectReason reason; + case PURPLE_SSL_HANDSHAKE_FAILED: + case PURPLE_SSL_CONNECT_FAILED: + reason = PURPLE_REASON_ENCRYPTION_ERROR; + case PURPLE_SSL_CERTIFICATE_INVALID: + /* TODO: maybe PURPLE_SSL_* should be more specific? */ + reason = PURPLE_REASON_CERT_OTHER_ERROR; + g_assert_not_reached (); + reason = PURPLE_REASON_ENCRYPTION_ERROR; + purple_connection_error_reason (gc, reason, purple_ssl_strerror(ssl_error)); purple_connection_reason_is_fatal (PurpleDisconnectReason reason)
--- a/libpurple/connection.h Wed Sep 19 11:39:42 2007 +0000
+++ b/libpurple/connection.h Wed Sep 19 15:00:48 2007 +0000
@@ -121,6 +121,7 @@
/** Connection UI operations. Used to notify the user of changes to
* connections, such as being disconnected, and to respond to the
@@ -389,6 +390,15 @@
const char *description);
+ * Closes a connection due to an SSL error; this is basically a shortcut to + * turning the #PurpleSslErrorType into a #PurpleDisconnectReason and a + * human-readable string and then calling purple_connection_error_reason(). +purple_connection_ssl_error (PurpleConnection *gc, + PurpleSslErrorType ssl_error); * Reports whether a disconnection reason is fatal (in which case the account
* should probably not be automatically reconnected) or transient (so
* auto-reconnection is a good idea.
--- a/libpurple/sslconn.h Wed Sep 19 11:39:42 2007 +0000
+++ b/libpurple/sslconn.h Wed Sep 19 15:00:48 2007 +0000
@@ -26,11 +26,6 @@
#ifndef _PURPLE_SSLCONN_H_
#define _PURPLE_SSLCONN_H_
-#include "certificate.h"
-#define PURPLE_SSL_DEFAULT_PORT 443
PURPLE_SSL_HANDSHAKE_FAILED = 1,
@@ -38,6 +33,11 @@
PURPLE_SSL_CERTIFICATE_INVALID = 3
+#include "certificate.h" +#define PURPLE_SSL_DEFAULT_PORT 443 typedef struct _PurpleSslConnection PurpleSslConnection;
typedef void (*PurpleSslInputFunction)(gpointer, PurpleSslConnection *,