--- a/libpurple/connection.c Thu Mar 17 21:41:10 2022 -0500
+++ b/libpurple/connection.c Thu Mar 17 23:22:29 2022 -0500
@@ -47,6 +47,8 @@
struct _PurpleConnection {
PurpleProtocol *protocol; /* The protocol. */
PurpleConnectionFlags flags; /* Connection flags. */
@@ -83,6 +85,7 @@
@@ -275,6 +278,13 @@
+purple_connection_get_id(PurpleConnection *connection) { + g_return_val_if_fail(PURPLE_IS_CONNECTION(connection), NULL); purple_connection_get_protocol(PurpleConnection *gc) {
g_return_val_if_fail(PURPLE_IS_CONNECTION(gc), NULL);
@@ -641,6 +651,18 @@
+/************************************************************************** + **************************************************************************/ +purple_connection_set_id(PurpleConnection *connection, const gchar *id) { + g_free(connection->id); + connection->id = g_strdup(id); + g_object_notify_by_pspec(G_OBJECT(connection), properties[PROP_ID]); /**************************************************************************
**************************************************************************/
@@ -652,6 +674,9 @@
PurpleConnection *gc = PURPLE_CONNECTION(obj);
+ purple_connection_set_id(gc, g_value_get_string(value)); gc->protocol = g_value_get_object(value);
@@ -684,6 +709,9 @@
PurpleConnection *gc = PURPLE_CONNECTION(obj);
+ g_value_set_string(value, purple_connection_get_id(gc)); g_value_set_object(value, purple_connection_get_protocol(gc));
@@ -721,6 +749,14 @@
G_OBJECT_CLASS(purple_connection_parent_class)->constructed(object);
+ gchar *uuid = g_uuid_string_random(); + purple_connection_set_id(gc, uuid); g_object_get(gc, "account", &account, NULL);
purple_account_set_connection(account, gc);
@@ -796,6 +832,7 @@
purple_str_wipe(gc->password);
g_free(gc->display_name);
G_OBJECT_CLASS(purple_connection_parent_class)->finalize(object);
@@ -809,6 +846,12 @@
obj_class->finalize = purple_connection_finalize;
obj_class->constructed = purple_connection_constructed;
+ properties[PROP_ID] = g_param_spec_string( + "The identifier of the account", + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); properties[PROP_PROTOCOL] = g_param_spec_object(
"The protocol that the connection is using.",
--- a/libpurple/connection.h Thu Mar 17 21:41:10 2022 -0500
+++ b/libpurple/connection.h Thu Mar 17 23:22:29 2022 -0500
@@ -406,6 +406,18 @@
purple_connection_is_disconnecting(PurpleConnection *gc);
+ * purple_connection_get_id: + * @connection: The connection. + * Gets the identifier of the connection. + * Returns: The identifier of the connection. +const gchar *purple_connection_get_id(PurpleConnection *connection); * purple_connection_get_account: