]> git.0d.be Git - empathy.git/commitdiff
Don't require EmpathyContacts to start a call
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Tue, 22 Feb 2011 18:14:07 +0000 (18:14 +0000)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Thu, 9 Jun 2011 09:20:05 +0000 (10:20 +0100)
Conflicts:

libempathy-gtk/empathy-contact-menu.c
libempathy-gtk/empathy-individual-menu.c
libempathy-gtk/empathy-new-call-dialog.c

libempathy-gtk/empathy-call-utils.c
libempathy-gtk/empathy-call-utils.h
libempathy-gtk/empathy-contact-menu.c
libempathy-gtk/empathy-individual-menu.c
libempathy-gtk/empathy-new-call-dialog.c
src/empathy-call-factory.c
src/empathy-streamed-media-handler.c

index c95b662365ef693502b7c94bc44903932a59b385..2a4158539a1365b71f78b87a567d7ff584484fe2 100644 (file)
@@ -35,7 +35,7 @@
 
 #if HAVE_CALL
 GHashTable *
-empathy_call_create_call_request (EmpathyContact *contact,
+empathy_call_create_call_request (const gchar *contact,
     gboolean initial_audio,
     gboolean initial_video)
 {
@@ -44,8 +44,8 @@ empathy_call_create_call_request (EmpathyContact *contact,
       TPY_IFACE_CHANNEL_TYPE_CALL,
     TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT,
       TP_HANDLE_TYPE_CONTACT,
-    TP_PROP_CHANNEL_TARGET_HANDLE, G_TYPE_UINT,
-      empathy_contact_get_handle (contact),
+    TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING,
+      contact,
     TPY_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, G_TYPE_BOOLEAN,
       initial_audio,
     TPY_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, G_TYPE_BOOLEAN,
@@ -55,7 +55,7 @@ empathy_call_create_call_request (EmpathyContact *contact,
 #endif
 
 GHashTable *
-empathy_call_create_streamed_media_request (EmpathyContact *contact,
+empathy_call_create_streamed_media_request (const gchar *contact,
     gboolean initial_audio,
     gboolean initial_video)
 {
@@ -64,8 +64,8 @@ empathy_call_create_streamed_media_request (EmpathyContact *contact,
       TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
     TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT,
       TP_HANDLE_TYPE_CONTACT,
-    TP_PROP_CHANNEL_TARGET_HANDLE, G_TYPE_UINT,
-      empathy_contact_get_handle (contact),
+    TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING,
+      contact,
     TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_AUDIO, G_TYPE_BOOLEAN,
       initial_audio,
     TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_VIDEO, G_TYPE_BOOLEAN,
@@ -121,14 +121,14 @@ create_call_channel_cb (GObject *source,
 #endif
 
 void
-empathy_call_new_with_streams (EmpathyContact *contact,
+empathy_call_new_with_streams (const gchar *contact,
+    TpAccount *account,
     gboolean initial_audio,
     gboolean initial_video,
     gint64 timestamp)
 {
 #if HAVE_CALL
   GHashTable *call_request, *streamed_media_request;
-  TpAccount *account;
   TpAccountChannelRequest *call_req, *streamed_media_req;
 
   call_request = empathy_call_create_call_request (contact,
@@ -138,8 +138,6 @@ empathy_call_new_with_streams (EmpathyContact *contact,
   streamed_media_request = empathy_call_create_streamed_media_request (
       contact, initial_audio, initial_video);
 
-  account = empathy_contact_get_account (contact);
-
   call_req = tp_account_channel_request_new (account, call_request, timestamp);
   streamed_media_req = tp_account_channel_request_new (account,
       streamed_media_request,
index 1bea52f6ae56aba2ed75cb8af0dc9e20e5bdc468..99a97f202233bc57952f5cf810c22937fc64ff38 100644 (file)
 #ifndef __EMPATHY_CALL_UTILS_H__
 #define __EMPATHY_CALL_UTILS_H__
 
-#include <libempathy/empathy-contact.h>
-
 G_BEGIN_DECLS
 
 /* Calls */
-void empathy_call_new_with_streams (EmpathyContact *contact,
+void empathy_call_new_with_streams (const gchar *contact,
+    TpAccount *account,
     gboolean initial_audio,
     gboolean initial_video,
     gint64 timestamp);
 
-GHashTable * empathy_call_create_call_request (
-    EmpathyContact *contact,
+GHashTable * empathy_call_create_call_request (const gchar *contact,
     gboolean initial_audio,
     gboolean initial_video);
 
-GHashTable * empathy_call_create_streamed_media_request (
-    EmpathyContact *contact,
+GHashTable * empathy_call_create_streamed_media_request (const gchar *contact,
     gboolean initial_audio,
     gboolean initial_video);
 
index 86b9f319e22e4891242292be74e2d25d13642114..60e7052ea3711e7974ee177910c31afec838f94c 100644 (file)
@@ -344,7 +344,9 @@ static void
 empathy_contact_audio_call_menu_item_activated (GtkMenuItem *item,
        EmpathyContact *contact)
 {
-       empathy_call_new_with_streams (contact, TRUE, FALSE,
+       empathy_call_new_with_streams (empathy_contact_get_id (contact),
+               empathy_contact_get_account (contact),
+               TRUE, FALSE,
                empathy_get_current_action_time ());
 }
 
@@ -375,7 +377,9 @@ static void
 empathy_contact_video_call_menu_item_activated (GtkMenuItem *item,
        EmpathyContact *contact)
 {
-       empathy_call_new_with_streams (contact, TRUE, TRUE,
+       empathy_call_new_with_streams (empathy_contact_get_id (contact),
+               empathy_contact_get_account (contact),
+               TRUE, TRUE,
                empathy_get_current_action_time ());
 }
 
index 33e2771358b98e74458b49dddbb6e0255fdd13b0..a92e5bcd980b97911fc6437003a756d2220b2bd6 100644 (file)
@@ -618,7 +618,9 @@ empathy_individual_audio_call_menu_item_activated (GtkMenuItem *item,
 {
   g_return_if_fail (EMPATHY_IS_CONTACT (contact));
 
-  empathy_call_new_with_streams (contact, TRUE, FALSE,
+  empathy_call_new_with_streams (empathy_contact_get_id (contact),
+      empathy_contact_get_account (contact),
+      TRUE, FALSE,
       empathy_get_current_action_time ());
 }
 
@@ -660,7 +662,9 @@ empathy_individual_video_call_menu_item_activated (GtkMenuItem *item,
 {
   g_return_if_fail (EMPATHY_IS_CONTACT (contact));
 
-  empathy_call_new_with_streams (contact, TRUE, TRUE,
+  empathy_call_new_with_streams (empathy_contact_get_id (contact),
+      empathy_contact_get_account (contact),
+      TRUE, TRUE,
       empathy_get_current_action_time ());
 }
 
index 0c0972de5a9f9b63d622962ce3f7b82505fb0d39..8fd273840af980471f0930dbf3ad69ff248a7130 100644 (file)
@@ -59,11 +59,6 @@ typedef struct {
   gpointer                                  user_data;
 } FilterCallbackData;
 
-typedef struct {
-  gboolean video;
-  gint64 timestamp;
-} ContactCallbackData;
-
 struct _EmpathyNewCallDialogPriv {
   GtkWidget *check_video;
 };
@@ -82,41 +77,6 @@ struct _EmpathyNewCallDialogPriv {
  * to be started with any contact on any enabled account.
  */
 
-static void
-got_contact_cb (TpConnection *connection,
-    EmpathyContact *contact,
-    const GError *error,
-    gpointer user_data,
-    GObject *weak_object)
-{
-  ContactCallbackData *data = user_data;
-
-  if (error != NULL)
-    g_warning ("Could not get contact: %s", error->message);
-  else
-    empathy_call_new_with_streams (contact,
-        TRUE, data->video, data->timestamp);
-
-  g_slice_free (ContactCallbackData, data);
-}
-
-static void
-call_contact (TpAccount *account,
-    const gchar *contact_id,
-    gboolean video,
-    gint64 timestamp)
-{
-  ContactCallbackData *data = g_slice_new0 (ContactCallbackData);
-
-  data->video = video;
-  data->timestamp = timestamp;
-
-  empathy_tp_contact_factory_get_from_id (tp_account_get_connection (account),
-      contact_id,
-      got_contact_cb, data,
-      NULL, NULL);
-}
-
 static void
 empathy_new_call_dialog_response (GtkDialog *dialog, int response_id)
 {
@@ -136,7 +96,8 @@ empathy_new_call_dialog_response (GtkDialog *dialog, int response_id)
    * we return from this function. */
   video = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_video));
 
-  call_contact (account, contact_id, video,
+  empathy_call_new_with_streams (contact_id,
+      account, TRUE, video,
       empathy_get_current_action_time ());
 
 out:
index 660a743bb2a7b33b7e816e302a70d63507d16614..0bae03a0cb73a65d3e90f9042bcd01152010e910 100644 (file)
@@ -240,7 +240,8 @@ empathy_call_factory_new_call_with_streams (EmpathyContact *contact,
   TpAccount *account;
   TpAccountChannelRequest *call_req;
 
-  call_request = empathy_call_create_call_request (contact,
+  call_request = empathy_call_create_call_request (
+      empathy_contact_get_id (contact),
       initial_audio, initial_video);
 
   account = empathy_contact_get_account (contact);
index 9d533b993c228eb192c8ef50f4d0acd6e53636c4..39e3e560d2f3f70931cd78c9a71d722960b2b1c3 100644 (file)
@@ -808,7 +808,8 @@ empathy_streamed_media_handler_start_call (EmpathyStreamedMediaHandler *handler,
   g_assert (priv->contact != NULL);
 
   account = empathy_contact_get_account (priv->contact);
-  request = empathy_call_create_streamed_media_request (priv->contact,
+  request = empathy_call_create_streamed_media_request (
+      empathy_contact_get_id (priv->contact),
       priv->initial_audio, priv->initial_video);
 
   req = tp_account_channel_request_new (account, request, timestamp);