[vino] VinoTubeServer uses the mc5 avatar cache and no more the mc4 avatar cache



commit 61485cbdc1b633862b8d038709120d56d2f83833
Author: Arnaud Maillet <arnaud maillet collabora co uk>
Date:   Mon Aug 24 12:13:43 2009 +0200

    VinoTubeServer uses the mc5 avatar cache and no more the mc4 avatar cache

 server/vino-tube-server.c |   49 ++++++++++++++++----------------------------
 1 files changed, 18 insertions(+), 31 deletions(-)
---
diff --git a/server/vino-tube-server.c b/server/vino-tube-server.c
index f69a930..4e1cca9 100644
--- a/server/vino-tube-server.c
+++ b/server/vino-tube-server.c
@@ -33,9 +33,6 @@
 #include "vino-tube-server.h"
 #include "vino-dbus-error.h"
 
-#define MC_DBUS_SERVICE "org.freedesktop.Telepathy.MissionControl"
-#define MC_DBUS_SERVICE_PATH "/org/freedesktop/Telepathy/MissionControl"
-
 G_DEFINE_TYPE (VinoTubeServer, vino_tube_server, VINO_TYPE_SERVER);
 
 #define VINO_TUBE_SERVER_GET_PRIVATE(obj)\
@@ -383,50 +380,40 @@ vino_tube_server_contact_get_avatar_filename (TpContact *contact,
     const gchar *token,
     VinoTubeServer *self)
 {
-  TpConnection *connection;
   gchar *avatar_path;
   gchar *avatar_file;
   gchar *token_escaped;
-  gchar *contact_escaped;
-  gchar *mc_account_unique_name;
-  GError *error = NULL;
-  DBusGProxy *proxy;
+  TpConnection *connection;
+  gchar *cm;
+  gchar *protocol;
 
-  connection = tp_contact_get_connection (contact);
+  if (contact == NULL)
+    return NULL;
 
-  proxy = dbus_g_proxy_new_for_name (tp_get_bus (), MC_DBUS_SERVICE,
-      MC_DBUS_SERVICE_PATH, MC_DBUS_SERVICE);
+  token_escaped = tp_escape_as_identifier (token);
 
-  /* Have to do that while waiting for mission control 5 because
-  there is no mc API in telepathy-glib */
-  if (!dbus_g_proxy_call (proxy, "GetAccountForConnection", &error,
-      G_TYPE_STRING, tp_proxy_get_object_path (connection),
-      G_TYPE_INVALID,
-      G_TYPE_STRING, &mc_account_unique_name,
-      G_TYPE_INVALID))
+  connection = tp_contact_get_connection (contact);
+
+  if (!tp_connection_parse_object_path (connection, &protocol, &cm))
     {
-      g_printerr ("Failed to request name: %s",
-          error ? error->message : "No error given");
-      g_clear_error (&error);
+      g_printerr ("Impossible to parse object path\n");
       return NULL;
     }
 
-  contact_escaped = tp_escape_as_identifier (tp_contact_get_identifier
-      (contact));
-
-  token_escaped = tp_escape_as_identifier (token);
-  connection = tp_contact_get_connection (contact);
-
   avatar_path = g_build_filename (g_get_user_cache_dir (),
-      "Empathy", "avatars", mc_account_unique_name,
-      contact_escaped, NULL);
+      "telepathy",
+      "avatars",
+      cm,
+      protocol,
+      NULL);
+  g_mkdir_with_parents (avatar_path, 0700);
 
   avatar_file = g_build_filename (avatar_path, token_escaped, NULL);
 
-  g_free (contact_escaped);
   g_free (token_escaped);
   g_free (avatar_path);
-  g_object_unref (proxy);
+  g_free (cm);
+  g_free (protocol);
 
   return avatar_file;
 }



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