soc.2009.telepathy: 942b81e9: Added telepathy_contact struct, preparin...

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Sat Jun 13 10:25:29 EDT 2009


-----------------------------------------------------------------
Revision: 942b81e92e847749697e1935c8e93d6ca99ca503
Ancestor: 55a5efb6c79a36db4baaeb10f71f913f82dadaee
Author: sttwister at soc.pidgin.im
Date: 2009-06-13T14:24:09
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/942b81e92e847749697e1935c8e93d6ca99ca503

Modified files:
        libpurple/protocols/telepathy/telepathy.c

ChangeLog: 

Added telepathy_contact struct, preparing for handling of avatars

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	82ef33e54c0c9d608e3e174156053dbb35e129dd
+++ libpurple/protocols/telepathy/telepathy.c	98548c2a1b9f63e8d8b569fb05bfc483d4bf2754
@@ -64,7 +64,7 @@ typedef struct
 	/* This will hold pointers to telepathy_text_channel for buddies that have an active conversation */
 	GHashTable *text_Channels;
 	
-	/* This will map contact handles to TpContact */
+	/* This will map contact handles to telepathy_contact */
 	GHashTable *contacts;
 	
 } telepathy_connection;
@@ -86,6 +86,20 @@ typedef struct
 
 typedef struct
 {
+	TpContact *contact;
+
+} telepathy_contact;
+
+
+static void
+destroy_contact(telepathy_contact *contact_data)
+{
+	g_object_unref(contact_data->contact);
+	g_free(contact_data);
+}
+
+typedef struct
+{
 	telepathy_connection *connection_data;
 	TpChannel *channel;
 
@@ -368,8 +382,11 @@ group_contacts_ready_cb (TpConnection *c
 
 			if (g_hash_table_lookup(data->connection_data->contacts, (gpointer)handle) == NULL)
 			{
-				g_hash_table_insert(data->connection_data->contacts, (gpointer)handle, contact);
+				telepathy_contact *contact_data = g_new0(telepathy_contact, 1);
+				contact_data-> contact = contact;
 
+				g_hash_table_insert(data->connection_data->contacts, (gpointer)handle, contact_data);
+
 				g_object_ref(contact);
 				g_signal_connect(contact, "notify", G_CALLBACK (contact_notify_cb), data->connection_data);
 				contact_notify_cb (contact, NULL, data->connection_data);
@@ -439,8 +456,11 @@ contacts_ready_cb (TpConnection *connect
 
 			if (g_hash_table_lookup(data->contacts, (gpointer)handle) == NULL)
 			{
-				g_hash_table_insert(data->contacts, (gpointer)handle, contact);
+				telepathy_contact *contact_data = g_new0(telepathy_contact, 1);
+				contact_data->contact = contact;
 
+				g_hash_table_insert(data->contacts, (gpointer)handle, contact_data);
+
 				g_object_ref(contact);
 				g_signal_connect(contact, "notify", G_CALLBACK (contact_notify_cb), user_data);
 				contact_notify_cb (contact, NULL, user_data);
@@ -1027,7 +1047,7 @@ status_changed_cb (TpConnection *proxy,
 		purple_connection_set_state(data->gc, PURPLE_CONNECTED);
 
 		data->text_Channels = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) destroy_text_channel);
-		data->contacts = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_object_unref);
+		data->contacts = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) destroy_contact);
 	}
 	else if (arg_Status == TP_CONNECTION_STATUS_DISCONNECTED)
 	{


More information about the Commits mailing list