]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-utils.c
empathy-tp-tube: remove initiator and type member variables as they are not used
[empathy.git] / libempathy / empathy-utils.c
index 99d89e0ebcce35363ec0820905509f6d4ca9e757..a476d9e54da325cb192dd49737f0e9143710a95c 100644 (file)
@@ -41,6 +41,7 @@
 #include "empathy-contact-manager.h"
 #include "empathy-dispatcher.h"
 #include "empathy-dispatch-operation.h"
+#include "empathy-idle.h"
 #include "empathy-tp-call.h"
 
 #include <extensions/extensions.h>
@@ -414,7 +415,7 @@ empathy_channel_get_account (TpChannel *channel)
        MissionControl *mc;
 
        g_object_get (channel, "connection", &connection, NULL);
-       mc = empathy_mission_control_new ();
+       mc = empathy_mission_control_dup_singleton ();
        account = mission_control_get_account_for_tpconnection (mc, connection, NULL);
        g_object_unref (connection);
        g_object_unref (mc);
@@ -452,33 +453,20 @@ empathy_proxy_equal (gconstpointer a,
               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)
+gboolean
+empathy_check_available_state (void)
 {
-  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 (contact);
-}
+       McPresence presence;
+       EmpathyIdle *idle;
 
-void
-empathy_start_call_with_contact (EmpathyContact *contact)
-{
-  g_object_ref (contact);
-  empathy_dispatcher_call_with_contact (contact, empathy_call_request_cb,
-    contact);
+       idle = empathy_idle_dup_singleton ();
+       presence = empathy_idle_get_state (idle);
+       g_object_unref (idle);
+
+       if (presence != MC_PRESENCE_AVAILABLE &&
+               presence != MC_PRESENCE_UNSET) {
+               return FALSE;    
+       }
+
+       return TRUE;
 }