From 3a91ef0255c807c3e60f0a153b81ea3b1b427343 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 14 Sep 2009 12:09:50 +0200 Subject: 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 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/empathy-import-pidgin.c b/src/empathy-import-pidgin.c index 877eb26b6..ccf0dac7a 100644 --- a/src/empathy-import-pidgin.c +++ b/src/empathy-import-pidgin.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -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")) { -- cgit v1.2.3