# HG changeset patch
# Node ID 79a18183953349b58ce3dee6c16e792589551d4f
# Parent  c2357ee3655101a195079f390d425740fcde00cf
diff --git a/libpurple/connection.c b/libpurple/connection.c
--- a/libpurple/connection.c
+++ b/libpurple/connection.c
@@ -34,15 +34,10 @@
 #include "signals.h"
 #include "util.h"
 
-/**
- * PurpleConnection:
- *
- * Represents an active connection on an account.
- */
 typedef struct {
 	GObject gparent;
 
-	gchar *id;
+	char *id;
 
 	GCancellable *cancellable;
 
@@ -133,7 +128,6 @@
 
 		handle = purple_connections_get_handle();
 		purple_signal_emit(handle, "signed-on", connection);
-		purple_signal_emit_return_1(handle, "autojoin", connection);
 
 		/* check if connections_connected is NULL, if so we need to emit the
 		 * online signal.
@@ -176,7 +170,7 @@
 	return priv->account;
 }
 
-const gchar *
+const char *
 purple_connection_get_id(PurpleConnection *connection) {
 	PurpleConnectionPrivate *priv = NULL;
 
@@ -351,21 +345,21 @@
 
 	if(error->domain == G_TLS_ERROR) {
 		switch (error->code) {
-			case G_TLS_ERROR_UNAVAILABLE:
-				reason = PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT;
-				break;
-			case G_TLS_ERROR_NOT_TLS:
-			case G_TLS_ERROR_HANDSHAKE:
-				reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR;
-				break;
-			case G_TLS_ERROR_BAD_CERTIFICATE:
-			case G_TLS_ERROR_CERTIFICATE_REQUIRED:
-				reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR;
-				break;
-			case G_TLS_ERROR_EOF:
-			case G_TLS_ERROR_MISC:
-			default:
-				reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
+		case G_TLS_ERROR_UNAVAILABLE:
+			reason = PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT;
+			break;
+		case G_TLS_ERROR_NOT_TLS:
+		case G_TLS_ERROR_HANDSHAKE:
+			reason = PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR;
+			break;
+		case G_TLS_ERROR_BAD_CERTIFICATE:
+		case G_TLS_ERROR_CERTIFICATE_REQUIRED:
+			reason = PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR;
+			break;
+		case G_TLS_ERROR_EOF:
+		case G_TLS_ERROR_MISC:
+		default:
+			reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
 		}
 	} else if (error->domain == G_IO_ERROR) {
 		reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
@@ -387,29 +381,29 @@
 gboolean
 purple_connection_error_is_fatal(PurpleConnectionError reason) {
 	switch (reason) {
-		case PURPLE_CONNECTION_ERROR_NETWORK_ERROR:
-		case PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR:
-		case PURPLE_CONNECTION_ERROR_CUSTOM_TEMPORARY:
-			return FALSE;
-		case PURPLE_CONNECTION_ERROR_INVALID_USERNAME:
-		case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED:
-		case PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE:
-		case PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT:
-		case PURPLE_CONNECTION_ERROR_NAME_IN_USE:
-		case PURPLE_CONNECTION_ERROR_INVALID_SETTINGS:
-		case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED:
-		case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED:
-		case PURPLE_CONNECTION_ERROR_CERT_EXPIRED:
-		case PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED:
-		case PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH:
-		case PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH:
-		case PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED:
-		case PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR:
-		case PURPLE_CONNECTION_ERROR_CUSTOM_FATAL:
-		case PURPLE_CONNECTION_ERROR_OTHER_ERROR:
-			return TRUE;
-		default:
-			g_return_val_if_reached(TRUE);
+	case PURPLE_CONNECTION_ERROR_NETWORK_ERROR:
+	case PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR:
+	case PURPLE_CONNECTION_ERROR_CUSTOM_TEMPORARY:
+		return FALSE;
+	case PURPLE_CONNECTION_ERROR_INVALID_USERNAME:
+	case PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED:
+	case PURPLE_CONNECTION_ERROR_AUTHENTICATION_IMPOSSIBLE:
+	case PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT:
+	case PURPLE_CONNECTION_ERROR_NAME_IN_USE:
+	case PURPLE_CONNECTION_ERROR_INVALID_SETTINGS:
+	case PURPLE_CONNECTION_ERROR_CERT_NOT_PROVIDED:
+	case PURPLE_CONNECTION_ERROR_CERT_UNTRUSTED:
+	case PURPLE_CONNECTION_ERROR_CERT_EXPIRED:
+	case PURPLE_CONNECTION_ERROR_CERT_NOT_ACTIVATED:
+	case PURPLE_CONNECTION_ERROR_CERT_HOSTNAME_MISMATCH:
+	case PURPLE_CONNECTION_ERROR_CERT_FINGERPRINT_MISMATCH:
+	case PURPLE_CONNECTION_ERROR_CERT_SELF_SIGNED:
+	case PURPLE_CONNECTION_ERROR_CERT_OTHER_ERROR:
+	case PURPLE_CONNECTION_ERROR_CUSTOM_FATAL:
+	case PURPLE_CONNECTION_ERROR_OTHER_ERROR:
+		return TRUE;
+	default:
+		g_return_val_if_reached(TRUE);
 	}
 }
 
@@ -417,7 +411,7 @@
  * Helpers
  **************************************************************************/
 static void
-purple_connection_set_id(PurpleConnection *connection, const gchar *id) {
+purple_connection_set_id(PurpleConnection *connection, const char *id) {
 	PurpleConnectionPrivate *priv = NULL;
 
 	priv = purple_connection_get_instance_private(connection);
@@ -454,26 +448,24 @@
 	priv = purple_connection_get_instance_private(connection);
 
 	switch (param_id) {
-		case PROP_ID:
-			purple_connection_set_id(connection, g_value_get_string(value));
-			break;
-		case PROP_PROTOCOL:
-			priv->protocol = g_value_get_object(value);
-			break;
-		case PROP_STATE:
-			purple_connection_set_state(connection, g_value_get_enum(value));
-			break;
-		case PROP_ACCOUNT:
-			purple_connection_set_account(connection,
-			                              g_value_get_object(value));
-			break;
-		case PROP_PASSWORD:
-			purple_connection_set_password(connection,
-			                               g_value_get_string(value));
-			break;
-		default:
-			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-			break;
+	case PROP_ID:
+		purple_connection_set_id(connection, g_value_get_string(value));
+		break;
+	case PROP_PROTOCOL:
+		priv->protocol = g_value_get_object(value);
+		break;
+	case PROP_STATE:
+		purple_connection_set_state(connection, g_value_get_enum(value));
+		break;
+	case PROP_ACCOUNT:
+		purple_connection_set_account(connection, g_value_get_object(value));
+		break;
+	case PROP_PASSWORD:
+		purple_connection_set_password(connection, g_value_get_string(value));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+		break;
 	}
 }
 
@@ -484,31 +476,28 @@
 	PurpleConnection *connection = PURPLE_CONNECTION(obj);
 
 	switch (param_id) {
-		case PROP_ID:
-			g_value_set_string(value, purple_connection_get_id(connection));
-			break;
-		case PROP_CANCELLABLE:
-			g_value_set_object(value,
-			                   purple_connection_get_cancellable(connection));
-			break;
-		case PROP_PROTOCOL:
-			g_value_set_object(value,
-			                   purple_connection_get_protocol(connection));
-			break;
-		case PROP_STATE:
-			g_value_set_enum(value, purple_connection_get_state(connection));
-			break;
-		case PROP_ACCOUNT:
-			g_value_set_object(value,
-			                   purple_connection_get_account(connection));
-			break;
-		case PROP_PASSWORD:
-			g_value_set_string(value,
-			                   purple_connection_get_password(connection));
-			break;
-		default:
-			G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
-			break;
+	case PROP_ID:
+		g_value_set_string(value, purple_connection_get_id(connection));
+		break;
+	case PROP_CANCELLABLE:
+		g_value_set_object(value,
+		                   purple_connection_get_cancellable(connection));
+		break;
+	case PROP_PROTOCOL:
+		g_value_set_object(value, purple_connection_get_protocol(connection));
+		break;
+	case PROP_STATE:
+		g_value_set_enum(value, purple_connection_get_state(connection));
+		break;
+	case PROP_ACCOUNT:
+		g_value_set_object(value, purple_connection_get_account(connection));
+		break;
+	case PROP_PASSWORD:
+		g_value_set_string(value, purple_connection_get_password(connection));
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
+		break;
 	}
 }
 
@@ -534,7 +523,7 @@
 	priv = purple_connection_get_instance_private(connection);
 
 	if(priv->id == NULL) {
-		gchar *uuid = g_uuid_string_random();
+		char *uuid = g_uuid_string_random();
 
 		purple_connection_set_id(connection, uuid);
 
@@ -594,8 +583,7 @@
 	 * Since: 3.0
 	 */
 	properties[PROP_ID] = g_param_spec_string(
-		"id", "id",
-		"The identifier of the connection",
+		"id", NULL, NULL,
 		NULL,
 		G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
 
@@ -610,8 +598,7 @@
 	 * Since: 3.0
 	 */
 	properties[PROP_CANCELLABLE] = g_param_spec_object(
-		"cancellable", "cancellable",
-		"A cancellable for the connection.",
+		"cancellable", NULL, NULL,
 		G_TYPE_CANCELLABLE,
 		G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
 
@@ -623,8 +610,7 @@
 	 * Since: 3.0
 	 */
 	properties[PROP_PROTOCOL] = g_param_spec_object(
-		"protocol", "Protocol",
-		"The protocol that the connection is using.",
+		"protocol", NULL, NULL,
 		PURPLE_TYPE_PROTOCOL,
 		G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
 
@@ -636,8 +622,7 @@
 	 * Since: 3.0
 	 */
 	properties[PROP_STATE] = g_param_spec_enum(
-		"state", "Connection state",
-		"The current state of the connection.",
+		"state", NULL, NULL,
 		PURPLE_TYPE_CONNECTION_STATE, PURPLE_CONNECTION_STATE_DISCONNECTED,
 		G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
 
@@ -649,8 +634,8 @@
 	 * Since: 3.0
 	 */
 	properties[PROP_ACCOUNT] = g_param_spec_object(
-		"account", "Account",
-		"The account using the connection.", PURPLE_TYPE_ACCOUNT,
+		"account", NULL, NULL,
+		PURPLE_TYPE_ACCOUNT,
 		G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
 
 	/**
@@ -663,8 +648,8 @@
 	 * Since: 3.0
 	 */
 	properties[PROP_PASSWORD] = g_param_spec_string(
-		"password", "Password",
-		"The password used for connection.", NULL,
+		"password", NULL, NULL,
+		NULL,
 		G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
 
 	g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
@@ -833,10 +818,6 @@
 	                       purple_marshal_VOID__POINTER_INT_POINTER,
 	                       G_TYPE_NONE, 3, PURPLE_TYPE_CONNECTION,
 	                       PURPLE_TYPE_CONNECTION_ERROR, G_TYPE_STRING);
-
-	purple_signal_register(handle, "autojoin",
-	                       purple_marshal_BOOLEAN__POINTER, G_TYPE_NONE, 1,
-	                       PURPLE_TYPE_CONNECTION);
 }
 
 void
diff --git a/libpurple/connection.h b/libpurple/connection.h
--- a/libpurple/connection.h
+++ b/libpurple/connection.h
@@ -34,17 +34,18 @@
 
 G_BEGIN_DECLS
 
-#define PURPLE_TYPE_CONNECTION  purple_connection_get_type()
+/**
+ * PurpleConnection:
+ *
+ * Represents an active connection on an account.
+ */
+
+#define PURPLE_TYPE_CONNECTION (purple_connection_get_type())
 
 PURPLE_AVAILABLE_IN_3_0
 G_DECLARE_DERIVABLE_TYPE(PurpleConnection, purple_connection, PURPLE,
                          CONNECTION, GObject)
 
-/* This is meant to track use-after-free errors.
- * TODO: it should be disabled in released code. */
-#define PURPLE_ASSERT_CONNECTION_IS_VALID(gc) \
-	_purple_assert_connection_is_valid(gc, __FILE__, __LINE__)
-
 /**
  * PurpleConnectionState:
  * @PURPLE_CONNECTION_STATE_DISCONNECTED: Disconnected
@@ -90,10 +91,6 @@
 	gpointer reserved[8];
 };
 
-/**************************************************************************/
-/* Connection API                                                         */
-/**************************************************************************/
-
 /**
  * purple_connection_connect:
  * @connection: The instance.
@@ -134,7 +131,7 @@
 
 /**
  * purple_connection_set_state:
- * @gc:    The connection.
+ * @connection: The connection.
  * @state: The connection state.
  *
  * Sets the connection state.  Protocols should call this and pass in
@@ -146,20 +143,20 @@
  * Since: 2.0
  */
 PURPLE_AVAILABLE_IN_ALL
-void purple_connection_set_state(PurpleConnection *gc, PurpleConnectionState state);
+void purple_connection_set_state(PurpleConnection *connection, PurpleConnectionState state);
 
 /**
  * purple_connection_get_state:
- * @gc: The connection.
+ * @connection: The connection.
  *
- * Returns the connection state.
+ * Gets the connection state.
  *
  * Returns: The connection state.
  *
  * Since: 2.0
  */
 PURPLE_AVAILABLE_IN_ALL
-PurpleConnectionState purple_connection_get_state(PurpleConnection *gc);
+PurpleConnectionState purple_connection_get_state(PurpleConnection *connection);
 
 /**
  * PURPLE_CONNECTION_IS_CONNECTED:
@@ -170,8 +167,8 @@
  *
  * Since: 2.0
  */
-#define PURPLE_CONNECTION_IS_CONNECTED(gc) \
-	(purple_connection_get_state(gc) == PURPLE_CONNECTION_STATE_CONNECTED)
+#define PURPLE_CONNECTION_IS_CONNECTED(connection) \
+	(purple_connection_get_state(connection) == PURPLE_CONNECTION_STATE_CONNECTED)
 
 /**
  * purple_connection_get_id:
@@ -188,7 +185,7 @@
 
 /**
  * purple_connection_get_account:
- * @gc: The connection.
+ * @connection: The connection.
  *
  * Returns the connection's account.
  *
@@ -197,11 +194,11 @@
  * Since: 2.0
  */
 PURPLE_AVAILABLE_IN_ALL
-PurpleAccount *purple_connection_get_account(PurpleConnection *gc);
+PurpleAccount *purple_connection_get_account(PurpleConnection *connection);
 
 /**
  * purple_connection_get_protocol:
- * @gc: The connection.
+ * @connection: The connection.
  *
  * Returns the protocol managing a connection.
  *
@@ -210,11 +207,11 @@
  * Since: 3.0
  */
 PURPLE_AVAILABLE_IN_3_0
-PurpleProtocol *purple_connection_get_protocol(PurpleConnection *gc);
+PurpleProtocol *purple_connection_get_protocol(PurpleConnection *connection);
 
 /**
  * purple_connection_get_password:
- * @gc: The connection.
+ * @connection: The connection.
  *
  * Returns the connection's password.
  *
@@ -223,7 +220,7 @@
  * Since: 2.0
  */
 PURPLE_AVAILABLE_IN_ALL
-const char *purple_connection_get_password(PurpleConnection *gc);
+const char *purple_connection_get_password(PurpleConnection *connection);
 
 /**
  * purple_connection_set_password:
@@ -258,9 +255,9 @@
 
 /**
  * purple_connection_error:
- * @gc:          the connection which is closing.
- * @reason:      why the connection is closing.
- * @description: a localized description of the error (not %NULL ).
+ * @connection: The connection which is closing.
+ * @reason: Why the connection is closing.
+ * @description: A localized description of the error.
  *
  * Closes a connection with an error and a human-readable description of the
  * error.
@@ -268,11 +265,11 @@
  * Since: 2.0
  */
 PURPLE_AVAILABLE_IN_ALL
-void purple_connection_error(PurpleConnection *gc, PurpleConnectionError reason, const char *description);
+void purple_connection_error(PurpleConnection *connection, PurpleConnectionError reason, const char *description);
 
 /**
  * purple_connection_get_error_info:
- * @gc: The connection.
+ * @connection: The connection.
  *
  * Returns the #PurpleConnectionErrorInfo instance of a connection if an
  * error exists.
@@ -283,11 +280,11 @@
  * Since: 3.0
  */
 PURPLE_AVAILABLE_IN_3_0
-PurpleConnectionErrorInfo *purple_connection_get_error_info(PurpleConnection *gc);
+PurpleConnectionErrorInfo *purple_connection_get_error_info(PurpleConnection *connection);
 
 /**
  * purple_connection_g_error:
- * @pc: Connection the error is associated with
+ * @connection: Connection the error is associated with
  * @error: Error information
  *
  * Closes a connection similar to [method@Purple.Connection.error], but takes a
@@ -302,11 +299,11 @@
  * Since: 3.0
  */
 PURPLE_AVAILABLE_IN_3_0
-void purple_connection_g_error(PurpleConnection *pc, const GError *error);
+void purple_connection_g_error(PurpleConnection *connection, const GError *error);
 
 /**
  * purple_connection_take_error:
- * @pc: Connection the error is associated with
+ * @connection: Connection the error is associated with
  * @error: Return address for a #GError, or %NULL.
  *
  * Closes a connection similar to [method@Purple.Connection.error], but takes a
@@ -318,7 +315,7 @@
  * Since: 3.0
  */
 PURPLE_AVAILABLE_IN_3_0
-void purple_connection_take_error(PurpleConnection *pc, GError *error);
+void purple_connection_take_error(PurpleConnection *connection, GError *error);
 
 /**
  * purple_connection_error_is_fatal:
diff --git a/libpurple/reference/signals_connection.md b/libpurple/reference/signals_connection.md
--- a/libpurple/reference/signals_connection.md
+++ b/libpurple/reference/signals_connection.md
@@ -9,7 +9,6 @@
 * [offline](#offline)
 * [signing-on](#signing-on)
 * [signed-on](#signed-on)
-* [autojoin](#autojoin)
 * [signing-off](#signing-off)
 * [signed-off](#signed-off)
 * [connection-error](#connection-error)
@@ -84,33 +83,6 @@
 
 ----
 
-#### autojoin
-
-```c
-gboolean user_function(PurpleConnection *gc, gpointer user_data);
-```
-
-Emitted when a connection has signed on, after the signed-on signal, to signal
-UIs to autojoin chats if they wish. UIs should connect to this with
-`PURPLE_SIGNAL_PRIORITY_HIGHEST` to allow plugins to block this signal before
-the UI sees it and then re-emit it later.
-
-**Parameters:**
-
-**gc**
-: The connection that has signed on.
-
-**user_data**
-: user data set when the signal handler was connected.
-
-**Returns:**
-
-`TRUE` if the signal was handled or `FALSE` otherwise.  In practice, the return
-value is irrelevant, as it really only exists so plugins can block the UI's
-autojoin.
-
-----
-
 #### signing-off
 
 ```c
