[empathy: 5/13] tp-call: use TargetHandle to get the remote contact



commit 066f1c90a7e6461ccb8ea11a2f511604abbd2472
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon Jun 21 16:47:18 2010 +0200

    tp-call: use TargetHandle to get the remote contact

 libempathy/empathy-tp-call.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c
index 4c78649..9758f50 100644
--- a/libempathy/empathy-tp-call.c
+++ b/libempathy/empathy-tp-call.c
@@ -278,9 +278,14 @@ tp_call_got_contact_cb (TpConnection            *connection,
     }
 
   priv->contact = g_object_ref (contact);
-  priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
+
+  if (priv->status < EMPATHY_TP_CALL_STATUS_PENDING)
+    {
+      priv->status = EMPATHY_TP_CALL_STATUS_PENDING;
+      g_object_notify (G_OBJECT (call), "status");
+    }
+
   g_object_notify (G_OBJECT (call), "contact");
-  g_object_notify (G_OBJECT (call), "status");
 }
 
 static void
@@ -298,16 +303,6 @@ tp_call_update_status (EmpathyTpCall *call)
   tp_intset_iter_init (&iter, set);
   while (tp_intset_iter_next (&iter))
     {
-      if (priv->contact == NULL && iter.element != self_handle)
-        {
-          TpConnection *connection;
-
-          /* We found the remote contact */
-          connection = tp_channel_borrow_connection (priv->channel);
-          empathy_tp_contact_factory_get_from_handle (connection, iter.element,
-              tp_call_got_contact_cb, NULL, NULL, G_OBJECT (call));
-        }
-
       if (priv->status == EMPATHY_TP_CALL_STATUS_PENDING &&
           ((priv->is_incoming && iter.element == self_handle) ||
            (!priv->is_incoming && iter.element != self_handle)))
@@ -433,6 +428,12 @@ tp_call_constructor (GType type,
 
   priv->is_incoming = !requested;
 
+  /* Get the remote contact */
+  empathy_tp_contact_factory_get_from_handle (
+      tp_channel_borrow_connection (priv->channel),
+      tp_channel_get_handle (priv->channel, NULL), tp_call_got_contact_cb,
+      NULL, NULL, object);
+
   /* Update status when members changes */
   tp_call_update_status (call);
   g_signal_connect_swapped (priv->channel, "group-members-changed",



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