empathy r2166 - trunk/libempathy



Author: xclaesse
Date: Fri Jan  9 16:14:14 2009
New Revision: 2166
URL: http://svn.gnome.org/viewvc/empathy?rev=2166&view=rev

Log:
Add a utility function to start a call to a contact

Signed-off-by: Sjoerd Simons <sjoerd simons collabora co uk>

Modified:
   trunk/libempathy/empathy-utils.c
   trunk/libempathy/empathy-utils.h

Modified: trunk/libempathy/empathy-utils.c
==============================================================================
--- trunk/libempathy/empathy-utils.c	(original)
+++ trunk/libempathy/empathy-utils.c	Fri Jan  9 16:14:14 2009
@@ -39,6 +39,9 @@
 #include "empathy-utils.h"
 #include "empathy-contact-factory.h"
 #include "empathy-contact-manager.h"
+#include "empathy-dispatcher.h"
+#include "empathy-dispatch-operation.h"
+#include "empathy-tp-call.h"
 
 #include <extensions/extensions.h>
 
@@ -448,3 +451,36 @@
 	return g_str_equal (proxy_a->object_path, proxy_b->object_path) &&
 	       g_str_equal (proxy_a->bus_name, proxy_b->bus_name);
 }
+
+static void
+empathy_call_request_cb (EmpathyDispatchOperation *operation,
+  const GError *error, gpointer user_data)
+{
+  EmpathyContact *contact = EMPATHY_CONTACT (user_data);
+
+  if (error != NULL)
+    {
+      DEBUG ("Failed to request streamed media channel %s",
+        error->message);
+    }
+  else
+    {
+      EmpathyTpCall *call =
+        EMPATHY_TP_CALL (
+          empathy_dispatch_operation_get_channel_wrapper (operation));
+
+      empathy_tp_call_to (call, contact);
+
+      g_object_unref (call);
+    }
+
+  g_object_unref (contact);
+}
+
+void
+empathy_start_call_with_contact (EmpathyContact *contact)
+{
+  g_object_ref (contact);
+  empathy_dispatcher_call_with_contact (contact, empathy_call_request_cb,
+    contact);
+}

Modified: trunk/libempathy/empathy-utils.h
==============================================================================
--- trunk/libempathy/empathy-utils.h	(original)
+++ trunk/libempathy/empathy-utils.h	Fri Jan  9 16:14:14 2009
@@ -88,6 +88,10 @@
 						     gconstpointer    b);
 guint        empathy_proxy_hash                     (gconstpointer    key);
 
+/* Temporary utility function, should be replaces by better voip infrastructure
+ * soon */
+void empathy_start_call_with_contact (EmpathyContact *contact);
+
 G_END_DECLS
 
 #endif /*  __EMPATHY_UTILS_H__ */



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