empathy r945 - trunk/libempathy



Author: xclaesse
Date: Tue Apr 15 12:26:08 2008
New Revision: 945
URL: http://svn.gnome.org/viewvc/empathy?rev=945&view=rev

Log:
Get the chat ID only if the handle and handle_type are != 0. Get the remote_contact from the channel's handle if it's of type CONTACT.


Modified:
   trunk/libempathy/empathy-tp-chat.c

Modified: trunk/libempathy/empathy-tp-chat.c
==============================================================================
--- trunk/libempathy/empathy-tp-chat.c	(original)
+++ trunk/libempathy/empathy-tp-chat.c	Tue Apr 15 12:26:08 2008
@@ -731,8 +731,6 @@
 	EmpathyTpChatPriv *priv = GET_PRIV (chat);
 	TpConnection      *connection;
 	guint              handle, handle_type;
-	GArray            *handles;
-	gchar            **names;
 
 	empathy_debug (DEBUG_DOMAIN, "Channel ready");
 
@@ -742,15 +740,26 @@
 		      "handle_type", &handle_type,
 		      NULL);
 
-	handles = g_array_new (FALSE, FALSE, sizeof (guint));
-	g_array_append_val (handles, handle);
-	tp_cli_connection_run_inspect_handles (connection, -1,
-					       handle_type, handles,
-					       &names, NULL, NULL);
-	g_array_free (handles, TRUE);
+	if (handle_type != TP_HANDLE_TYPE_NONE && handle != 0) {
+		GArray *handles;
+		gchar **names;
+
+		handles = g_array_new (FALSE, FALSE, sizeof (guint));
+		g_array_append_val (handles, handle);
+		tp_cli_connection_run_inspect_handles (connection, -1,
+						       handle_type, handles,
+						       &names, NULL, NULL);
+		priv->id = *names;
+		g_array_free (handles, TRUE);
+		g_free (names);
+	}
 
-	priv->id = *names;
-	g_free (names);
+	if (handle_type == TP_HANDLE_TYPE_CONTACT && handle != 0) {
+		priv->remote_contact = empathy_contact_factory_get_from_handle (priv->factory,
+										priv->account,
+										handle);
+		g_object_notify (G_OBJECT (chat), "remote-contact");
+	}
 
 	if (tp_proxy_has_interface_by_id (priv->channel,
 					  TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)) {
@@ -766,11 +775,6 @@
 				  G_CALLBACK (tp_chat_local_pending_cb),
 				  chat);
 		empathy_run_until_ready (priv->group);
-	} else {
-		priv->remote_contact = empathy_contact_factory_get_from_handle (priv->factory,
-										priv->account,
-										handle);
-		g_object_notify (G_OBJECT (chat), "remote-contact");
 	}
 	
 	if (tp_proxy_has_interface_by_id (priv->channel,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]