[empathy] Watch the DBus signature of the param.



commit 3a91ef0255c807c3e60f0a153b81ea3b1b427343
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Sep 14 12:09:50 2009 +0200

    Watch the DBus signature of the param.
    
    We used to hardcode UINT, but this does not work for haze CMs.

 src/empathy-import-pidgin.c |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/src/empathy-import-pidgin.c b/src/empathy-import-pidgin.c
index 877eb26..ccf0dac 100644
--- a/src/empathy-import-pidgin.c
+++ b/src/empathy-import-pidgin.c
@@ -26,6 +26,7 @@
 
 #include <glib.h>
 #include <glib/gstdio.h>
+#include <dbus/dbus-protocol.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
 
@@ -139,12 +140,34 @@ import_dialog_pidgin_parse_setting (EmpathyImportAccountData *data,
     }
   else if (!tp_strdiff (type, "int"))
     {
+      TpConnectionManager *cm = NULL;
+      const TpConnectionManagerProtocol *proto;
+      const TpConnectionManagerParam *param;
+      const gchar *signature;
+      int signature_i;
+
+      if (!empathy_import_protocol_is_supported (data->protocol, &cm))
+        return;
+
+      proto = tp_connection_manager_get_protocol (cm, data->protocol);
+      param = tp_connection_manager_protocol_get_param (proto, item->cm_name);
+      signature = tp_connection_manager_param_get_dbus_signature (param);
+      signature_i = (int) (*signature);
+
       i = (gint) g_ascii_strtod (content, NULL);
-      /* FIXME: Pidgin uses signed int values whereas Telepathy usually
-       * uses unsigned int values.
-       */
-      value = tp_g_value_slice_new (G_TYPE_UINT);
-      g_value_set_uint (value, (guint) i);
+
+      if (signature_i == DBUS_TYPE_INT16 ||
+          signature_i == DBUS_TYPE_INT32)
+        {
+          value = tp_g_value_slice_new (G_TYPE_INT);
+          g_value_set_int (value, i);
+        }
+      else if (signature_i == DBUS_TYPE_UINT16 ||
+          signature_i == DBUS_TYPE_UINT32)
+        {
+          value = tp_g_value_slice_new (G_TYPE_UINT);
+          g_value_set_uint (value, (guint) i);
+        }
     }
   else if (!tp_strdiff (type, "string"))
     {



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