soc.2009.telepathy: dcf7728e: Close channel when leaving chatroom

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Tue Jul 14 16:21:32 EDT 2009


-----------------------------------------------------------------
Revision: dcf7728e1cc271c163831e5dff5b76a3a5b0aaeb
Ancestor: d7e1569185823fa5f3c960a4a6a09d5bd4d519b0
Author: sttwister at soc.pidgin.im
Date: 2009-07-14T20:12:13
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/dcf7728e1cc271c163831e5dff5b76a3a5b0aaeb

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

ChangeLog: 

Close channel when leaving chatroom

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	746ea1b9fb4496d958b873a6ce52236c227fa2a7
+++ libpurple/protocols/telepathy/telepathy.c	bba6d13b052935f13424bbc8bb44d958f2ea2fec
@@ -576,6 +576,17 @@ telepathy_join_chat (PurpleConnection *g
 			map, ensure_channel_cb, data, NULL, NULL);
 }
 
+static void
+telepathy_chat_leave (PurpleConnection *gc, int id)
+{
+	telepathy_connection *data = purple_connection_get_protocol_data(gc);
+
+	telepathy_room_channel *tp_channel = g_hash_table_lookup(
+			data->room_Channels, (gpointer)(TpHandle)id);
+
+	tp_cli_channel_call_close(tp_channel->channel, -1, NULL, NULL, NULL, NULL);
+}
+
 static int
 telepathy_chat_send (PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags)
 {
@@ -707,7 +718,7 @@ static PurplePluginProtocolInfo telepath
 	NULL,                /* reject_chat */
 	NULL,              /* get_chat_name */
 	NULL,                /* chat_invite */
-	NULL,                 /* chat_leave */
+	telepathy_chat_leave,                 /* chat_leave */
 	NULL,               /* chat_whisper */
 	telepathy_chat_send,                  /* chat_send */
 	NULL,                                /* keepalive */
============================================================
--- libpurple/protocols/telepathy/telepathy_channel_text.c	bc420eea6d1c8231a83b92ecd058e9fac3b82b81
+++ libpurple/protocols/telepathy/telepathy_channel_text.c	019a77759f8acbcbd6f7223cc97d12bc078a2777
@@ -413,19 +413,8 @@ room_channel_invalidated_cb (TpProxy *se
 	/* 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 (connection_data->text_Channels)
-		tp_channel = g_hash_table_lookup(connection_data->room_Channels,
-				(gpointer)handle);
-
 	purple_debug_info("telepathy", "Chatroom channel with handle %u closed!\n", handle);
 
-	if (tp_channel)
-	{
-		tp_channel->channel = NULL;
-	}
-
 	/* Unref all the contacts in the chatroom */
 	g_hash_table_iter_init (&iter, data->contacts);
 	while (g_hash_table_iter_next (&iter, &key, &value)) 
@@ -435,7 +424,7 @@ room_channel_invalidated_cb (TpProxy *se
 
 	g_hash_table_destroy(data->contacts);
 
-	g_object_unref(self);
+	g_hash_table_remove(connection_data->room_Channels, (gpointer)handle);
 }
 
 static void
@@ -898,8 +887,6 @@ text_channel_invalidated_cb (TpProxy *se
 	{
 		tp_channel->channel = NULL;
 	}
-
-	g_object_unref(self);
 }
 
 void


More information about the Commits mailing list