Remove PurpleConnectionUiOps as they are no longer used

Thu, 11 Apr 2024 21:32:59 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 11 Apr 2024 21:32:59 -0500
changeset 42692
12506cd6fa96
parent 42691
dc218ad54cbd
child 42693
84cf660ed9ec

Remove PurpleConnectionUiOps as they are no longer used

Testing Done:
Checked in with the turtles.

Reviewed at https://reviews.imfreedom.org/r/3090/

ChangeLog.API file | annotate | diff | comparison | revisions
libpurple/connection.c file | annotate | diff | comparison | revisions
libpurple/connection.h file | annotate | diff | comparison | revisions
--- a/ChangeLog.API	Thu Apr 11 21:30:43 2024 -0500
+++ b/ChangeLog.API	Thu Apr 11 21:32:59 2024 -0500
@@ -81,8 +81,6 @@
 		* purple_circ_buffer_* functions are now purple_circular_buffer_*
 		* purple_connection_error now takes a PurpleConnectionError
 		  as the second parameter
-		* PurpleConnection is now a GObject. Please see the documentation for
-		  details.
 		* PURPLE_CONNECTION_* prefix of PurpleConnectionFlag enum names changed
 		  to PURPLE_CONNECTION_FLAG_*
 		* PURPLE_* prefix of PurpleConnectionState enum names changed to
@@ -386,10 +384,11 @@
 		* purple_connection_set_account
 		* purple_connection_set_protocol_data
 		* purple_connection_ssl_error
-		* PurpleConnectionUiOps->connect_progress
-		* PurpleConnectionUiOps->notice
+		* PurpleConnectionUiOps
 		* purple_connection_update_progress
 		* purple_connections_get_connecting
+		* purple_connections_get_ui_ops
+		* purple_connections_set_ui_ops
 		* purple_contact_set_alias
 		* purple_conv_chat_set_users
 		* purple_conv_custom_smiley_add
--- a/libpurple/connection.c	Thu Apr 11 21:30:43 2024 -0500
+++ b/libpurple/connection.c	Thu Apr 11 21:32:59 2024 -0500
@@ -94,7 +94,6 @@
 
 static GList *connections = NULL;
 static GList *connections_connected = NULL;
-static PurpleConnectionUiOps *connection_ui_ops = NULL;
 
 static int connections_handle;
 
@@ -119,7 +118,6 @@
                             PurpleConnectionState state)
 {
 	PurpleConnectionPrivate *priv = NULL;
-	PurpleConnectionUiOps *ops = NULL;
 
 	g_return_if_fail(PURPLE_IS_CONNECTION(connection));
 
@@ -131,8 +129,6 @@
 
 	priv->state = state;
 
-	ops = purple_connections_get_ui_ops();
-
 	if(priv->state == PURPLE_CONNECTION_STATE_CONNECTED) {
 		PurplePresence *presence;
 		GDateTime *timestamp = NULL;
@@ -146,10 +142,6 @@
 		purple_presence_set_login_time(presence, timestamp);
 		g_date_time_unref(timestamp);
 
-		if(ops != NULL && ops->connected != NULL) {
-			ops->connected(connection);
-		}
-
 		purple_blist_add_account(priv->account);
 
 		handle = purple_connections_get_handle();
@@ -169,10 +161,6 @@
 		if(emit_online) {
 			purple_signal_emit(handle, "online");
 		}
-	} else if(priv->state == PURPLE_CONNECTION_STATE_DISCONNECTED) {
-		if(ops != NULL && ops->disconnected != NULL) {
-			ops->disconnected(connection);
-		}
 	}
 
 	g_object_notify_by_pspec(G_OBJECT(connection), properties[PROP_STATE]);
@@ -390,7 +378,6 @@
                         const char *description)
 {
 	PurpleConnectionPrivate *priv = NULL;
-	PurpleConnectionUiOps *ops;
 
 	g_return_if_fail(PURPLE_IS_CONNECTION(connection));
 
@@ -424,12 +411,6 @@
 	                  "Connection error on %p (reason: %u description: %s)\n",
 	                  connection, reason, description);
 
-	ops = purple_connections_get_ui_ops();
-
-	if(ops && ops->report_disconnect) {
-		ops->report_disconnect(connection, reason, description);
-	}
-
 	priv->error_info = purple_connection_error_info_new(reason, description);
 
 	purple_signal_emit(purple_connections_get_handle(), "connection-error",
@@ -524,35 +505,6 @@
 }
 
 /**************************************************************************
- * GBoxed code
- **************************************************************************/
-static PurpleConnectionUiOps *
-purple_connection_ui_ops_copy(PurpleConnectionUiOps *ops)
-{
-	PurpleConnectionUiOps *ops_new;
-
-	g_return_val_if_fail(ops != NULL, NULL);
-
-	ops_new = g_new(PurpleConnectionUiOps, 1);
-	*ops_new = *ops;
-
-	return ops_new;
-}
-
-GType
-purple_connection_ui_ops_get_type(void) {
-	static GType type = 0;
-
-	if(type == 0) {
-		type = g_boxed_type_register_static("PurpleConnectionUiOps",
-				(GBoxedCopyFunc)purple_connection_ui_ops_copy,
-				(GBoxedFreeFunc)g_free);
-	}
-
-	return type;
-}
-
-/**************************************************************************
  * Helpers
  **************************************************************************/
 static void
@@ -1012,16 +964,6 @@
 }
 
 void
-purple_connections_set_ui_ops(PurpleConnectionUiOps *ops) {
-	connection_ui_ops = ops;
-}
-
-PurpleConnectionUiOps *
-purple_connections_get_ui_ops(void) {
-	return connection_ui_ops;
-}
-
-void
 purple_connections_init(void) {
 	void *handle = purple_connections_get_handle();
 
--- a/libpurple/connection.h	Thu Apr 11 21:30:43 2024 -0500
+++ b/libpurple/connection.h	Thu Apr 11 21:32:59 2024 -0500
@@ -40,9 +40,6 @@
 G_DECLARE_DERIVABLE_TYPE(PurpleConnection, purple_connection, PURPLE,
                          CONNECTION, GObject)
 
-#define PURPLE_TYPE_CONNECTION_UI_OPS  (purple_connection_ui_ops_get_type())
-typedef struct _PurpleConnectionUiOps PurpleConnectionUiOps;
-
 /* This is meant to track use-after-free errors.
  * TODO: it should be disabled in released code. */
 #define PURPLE_ASSERT_CONNECTION_IS_VALID(gc) \
@@ -128,54 +125,6 @@
 	gpointer reserved[8];
 };
 
-/**
- * PurpleConnectionUiOps:
- * @connected: Called when a connection is established (just before the
- *   <link linkend="connections-signed-on"><literal>"signed-on"</literal></link>
- *             signal).
- * @disconnected: Called when a connection is ended (between the
- *   <link linkend="connections-signing-off"><literal>"signing-off"</literal></link>
- *   and <link linkend="connections-signed-off"><literal>"signed-off"</literal></link>
- *                signals).
- * @network_connected: Called when libpurple discovers that the computer's
- *                     network connection is active.  On Linux, this uses
- *                     Network Manager if available; on Windows, it uses
- *                     Win32's network change notification infrastructure.
- * @network_disconnected: Called when libpurple discovers that the computer's
- *                        network connection has gone away.
- * @report_disconnect: Called when an error causes a connection to be
- *                     disconnected. Called before @disconnected.
- *                     <sbr/>See purple_connection_error().
- *                     <sbr/>@reason: why the connection ended, if known, or
- *                                 #PURPLE_CONNECTION_ERROR_OTHER_ERROR, if not.
- *                     <sbr/>@text:   a localized message describing the
- *                                 disconnection in more detail to the user.
- *
- * Connection UI operations.  Used to notify the user of changes to
- * connections, such as being disconnected, and to respond to the
- * underlying network connection appearing and disappearing.  UIs should
- * call #purple_connections_set_ui_ops() with an instance of this struct.
- *
- * See <link linkend="chapter-ui-ops">List of <literal>UiOps</literal> Structures</link>
- *
- * Since: 2.0
- */
-struct _PurpleConnectionUiOps
-{
-	void (*connected)(PurpleConnection *gc);
-	void (*disconnected)(PurpleConnection *gc);
-
-	void (*report_disconnect)(PurpleConnection *gc,
-	                          PurpleConnectionError reason,
-	                          const char *text);
-
-	/*< private >*/
-	void (*_purple_reserved1)(void);
-	void (*_purple_reserved2)(void);
-	void (*_purple_reserved3)(void);
-	void (*_purple_reserved4)(void);
-};
-
 /**************************************************************************/
 /* Connection API                                                         */
 /**************************************************************************/
@@ -538,43 +487,6 @@
 gboolean purple_connections_is_online(void);
 
 /**************************************************************************/
-/* UI Registration Functions                                              */
-/**************************************************************************/
-
-/**
- * purple_connection_ui_ops_get_type:
- *
- * Returns: The #GType for the #PurpleConnectionUiOps boxed structure.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-GType purple_connection_ui_ops_get_type(void);
-
-/**
- * purple_connections_set_ui_ops:
- * @ops: The UI operations structure.
- *
- * Sets the UI operations structure to be used for connections.
- *
- * Since: 2.0
- */
-PURPLE_AVAILABLE_IN_ALL
-void purple_connections_set_ui_ops(PurpleConnectionUiOps *ops);
-
-/**
- * purple_connections_get_ui_ops:
- *
- * Returns the UI operations structure used for connections.
- *
- * Returns: The UI operations structure in use.
- *
- * Since: 2.0
- */
-PURPLE_AVAILABLE_IN_ALL
-PurpleConnectionUiOps *purple_connections_get_ui_ops(void);
-
-/**************************************************************************/
 /* Connections Subsystem                                                  */
 /**************************************************************************/
 

mercurial