]> git.0d.be Git - empathy.git/blobdiff - libempathy/gossip-utils.c
sv.po: Updated Swedish translation
[empathy.git] / libempathy / gossip-utils.c
index 6ab70ce4a059d53b731342b9235c933855fdedb4..27bcb85d1e684a39f48abbba8dc9ce6bbe9d3ae1 100644 (file)
 #include <glib/gi18n.h>
 
 #include <libxml/uri.h>
-#include <libmissioncontrol/mc-account.h>
 #include <libtelepathy/tp-helpers.h>
 
 #include "gossip-debug.h"
 #include "gossip-utils.h"
-#include "gossip-paths.h"
 #include "empathy-contact-manager.h"
 
 #define DEBUG_DOMAIN "Utils"
@@ -209,7 +207,7 @@ gossip_xml_validate (xmlDoc      *doc,
        xmlDtd       *dtd;
        gboolean      ret;
 
-       path = gossip_paths_get_dtd_path (dtd_filename);
+       path = g_build_filename (DATADIR, "empathy", dtd_filename, NULL);
 
        /* The list of valid chars is taken from libxml. */
        escaped = xmlURIEscapeStr (path, ":@&=+$,/?;");
@@ -447,3 +445,51 @@ gossip_mission_control_new (void)
        return mc;
 }
 
+gchar *
+gossip_get_channel_id (McAccount *account,
+                      TpChan    *tp_chan)
+{
+       MissionControl  *mc;
+       TpConn          *tp_conn;
+       GArray          *handles;
+       gchar          **names;
+       gchar           *name;
+       GError          *error;
+
+       g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL);
+       g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL);
+
+       mc = gossip_mission_control_new ();
+       tp_conn = mission_control_get_connection (mc, account, NULL);
+       g_object_unref (mc);
+
+       if (!tp_conn) {
+               return NULL;
+       }
+
+       /* Get the handle's name */
+       handles = g_array_new (FALSE, FALSE, sizeof (guint));
+       g_array_append_val (handles, tp_chan->handle);
+       if (!tp_conn_inspect_handles (DBUS_G_PROXY (tp_conn),
+                                     tp_chan->handle_type,
+                                     handles,
+                                     &names,
+                                     &error)) {
+               gossip_debug (DEBUG_DOMAIN, 
+                             "Couldn't get id: %s",
+                             error ? error->message : "No error given");
+
+               g_clear_error (&error);
+               g_array_free (handles, TRUE);
+               g_object_unref (tp_conn);
+               
+               return NULL;
+       }
+
+       name = *names;
+       g_free (names);
+       g_object_unref (tp_conn);
+
+       return name;
+}
+