soc.2009.telepathy: 1dc5118d: Fix chatroom channel invalidation

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Tue Jul 14 13:46:17 EDT 2009


-----------------------------------------------------------------
Revision: 1dc5118d35cc0632ac10157d052f1ab54043ada2
Ancestor: b56095297e40adeda49e0d5829591b0654ba9ebe
Author: sttwister at soc.pidgin.im
Date: 2009-07-14T17:38:55
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/1dc5118d35cc0632ac10157d052f1ab54043ada2

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

ChangeLog: 

Fix chatroom channel invalidation

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy_channel_text.c	20ebf488f419aaf746e93f2cf0eaca0e25aecf7c
+++ libpurple/protocols/telepathy/telepathy_channel_text.c	2fb9f0e18070912bf9a63516cab3db738a4fd467
@@ -88,8 +88,6 @@ chat_got_message (telepathy_room_channel
 
 	/* TODO: Get rid of the unknown sender bit */
 
-	purple_debug_info("telepathy", "received %s from %u\n", arg_Text, arg_Sender);
-
 	if (contact != NULL)
 		from = tp_contact_get_alias(contact);
 	else
@@ -400,6 +398,34 @@ static void
 }
 
 static void
+room_channel_invalidated_cb (TpProxy *self,
+                             guint    domain,
+                             gint     code,
+                             gchar   *message,
+                             gpointer user_data)
+{
+	telepathy_connection *data = user_data;
+
+	/* remove the cached TpChannel proxy when the channel closes */
+	TpHandle handle = tp_channel_get_handle((TpChannel *)self, NULL);
+
+	telepathy_room_channel *tp_channel = NULL;
+	
+	if (data->text_Channels)
+		tp_channel = g_hash_table_lookup(data->room_Channels, (gpointer)handle);
+
+	purple_debug_info("telepathy", "Chatroom channel with handle %u closed!\n", handle);
+
+	if (tp_channel)
+	{
+		tp_channel->channel = NULL;
+	}
+
+	g_object_unref(self);
+}
+
+
+static void
 handle_room_text_channel (TpChannel *channel,
                           telepathy_connection *data)
 {
@@ -445,7 +471,7 @@ handle_room_text_channel (TpChannel *cha
 	}
 
 
-	g_signal_connect(channel, "invalidated", G_CALLBACK(text_channel_invalidated_cb), data);
+	g_signal_connect(channel, "invalidated", G_CALLBACK(room_channel_invalidated_cb), data);
 
 	/* send pending messages */
 	while (tp_channel->pending_Messages != NULL)


More information about the Commits mailing list