[empathy: 45/99] Retrieve the contact for incoming calls so we can display it



commit 69f9dbdb487ac77e506aca37706141fbcccffccf
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Wed Feb 23 16:49:26 2011 +0000

    Retrieve the contact for incoming calls so we can display it

 src/empathy-event-manager.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)
---
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 32b8054..4e156cc 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -674,14 +674,29 @@ cdo_invalidated_cb (TpProxy *cdo,
 }
 
 static void
-event_manager_call_channel_got_contact (EventManagerApproval *approval)
+event_manager_call_channel_got_contact_cb (TpConnection *connection,
+                                 EmpathyContact *contact,
+                                 const GError *error,
+                                 gpointer user_data,
+                                 GObject *object)
 {
+  EventManagerApproval *approval = (EventManagerApproval *) user_data;
   EmpathyEventManagerPriv *priv = GET_PRIV (approval->manager);
-  GtkWidget *window = empathy_main_window_dup ();
+  GtkWidget *window;
   TpyCallChannel *call;
   gchar *header;
   gboolean video;
 
+  if (error != NULL)
+    {
+      DEBUG ("Can't get the contact for the call.. Rejecting?");
+      reject_approval (approval);
+      return;
+    }
+
+  window = empathy_main_window_dup ();
+  approval->contact = g_object_ref (contact);
+
   call = TPY_CALL_CHANNEL (approval->handler_instance);
 
   g_object_get (G_OBJECT (call), "initial-video", &video, NULL);
@@ -1064,9 +1079,15 @@ approve_channels (TpSimpleApprover *approver,
   else if (channel_type == TPY_IFACE_QUARK_CHANNEL_TYPE_CALL)
     {
       TpyCallChannel *call = TPY_CALL_CHANNEL (channel);
+      const gchar *id;
 
       approval->handler_instance = G_OBJECT (call);
-      event_manager_call_channel_got_contact (approval);
+
+      id = tp_channel_get_identifier (channel);
+
+      empathy_tp_contact_factory_get_from_id (connection, id,
+        event_manager_call_channel_got_contact_cb,
+        approval, NULL, G_OBJECT (self));
     }
   else if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_FILE_TRANSFER)
     {



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