]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-utils.c
Switch to calling CallFactory to make calls
[empathy.git] / libempathy / empathy-utils.c
index 87e593a85f0a96a82c994e232f92aea80bdd00c5..a476d9e54da325cb192dd49737f0e9143710a95c 100644 (file)
 #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-idle.h"
+#include "empathy-tp-call.h"
 
 #include <extensions/extensions.h>
 
@@ -226,7 +230,7 @@ empathy_account_equal (gconstpointer a,
 }
 
 MissionControl *
-empathy_mission_control_new (void)
+empathy_mission_control_dup_singleton (void)
 {
        static MissionControl *mc = NULL;
 
@@ -411,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);
@@ -448,3 +452,21 @@ empathy_proxy_equal (gconstpointer a,
        return g_str_equal (proxy_a->object_path, proxy_b->object_path) &&
               g_str_equal (proxy_a->bus_name, proxy_b->bus_name);
 }
+
+gboolean
+empathy_check_available_state (void)
+{
+       McPresence presence;
+       EmpathyIdle *idle;
+
+       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;
+}