diff -ur empathy-2.32.0.1/src/empathy-import-pidgin.c empathy-2.32.0.1.patched//src/empathy-import-pidgin.c --- empathy-2.32.0.1/src/empathy-import-pidgin.c 2010-10-04 13:19:27.000000000 +0400 +++ empathy-2.32.0.1.patched//src/empathy-import-pidgin.c 2010-10-11 16:16:56.000000000 +0400 @@ -93,6 +93,8 @@ #define PIDGIN_ACCOUNT_TAG_PROTOCOL "protocol" #define PIDGIN_ACCOUNT_TAG_PASSWORD "password" #define PIDGIN_ACCOUNT_TAG_SETTINGS "settings" +#define PIDGIN_SETTING_PROP_UI "ui" +#define PIDGIN_SETTING_PROP_NAME "name" #define PIDGIN_SETTING_PROP_TYPE "type" #define PIDGIN_PROTOCOL_BONJOUR "bonjour" #define PIDGIN_PROTOCOL_NOVELL "novell" @@ -110,7 +112,7 @@ /* We can't do anything if the setting don't have a name */ tag_name = (gchar *) xmlGetProp (setting, - (xmlChar *) PIDGIN_ACCOUNT_TAG_NAME); + (xmlChar *) PIDGIN_SETTING_PROP_NAME); if (!tag_name) return; @@ -183,10 +185,54 @@ g_free (content); } +static void +import_dialog_pidgin_handle_settings (EmpathyImportAccountData *data, + xmlNodePtr settings) +{ + xmlNodePtr setting; + gchar *tag_ui, *name, *type, *content; + + tag_ui = (gchar *) xmlGetProp (settings, (xmlChar *) PIDGIN_SETTING_PROP_UI); + + /* UI settings - fetch the Enabled parameter. + * The expected value of the ui property is 'gtk-gaim', which looks obsolete, + * but still valid for 2.7.3. + */ + if (tag_ui && !tp_strdiff (tag_ui, "gtk-gaim")) + { + for (setting = settings->children; setting; setting = setting->next) + { + name = (gchar *) xmlGetProp (setting, + (xmlChar *) PIDGIN_SETTING_PROP_NAME); + type = (gchar *) xmlGetProp (setting, + (xmlChar *) PIDGIN_SETTING_PROP_TYPE); + /* The Enabled parameter is supposed to be boolean. + * Pidgin name of the setting is 'auto-login'. + */ + if (!tp_strdiff (name, "auto-login") && !tp_strdiff (type, "bool")) + { + content = (gchar *) xmlNodeGetContent (setting); + data->enabled = (0 != (gint) g_ascii_strtod (content, NULL)); + g_free (content); + } + g_free (type); + g_free (name); + } + } + /* General settings. */ + else + { + for (setting = settings->children; setting; setting = setting->next) + import_dialog_pidgin_parse_setting (data, setting); + } + + g_free (tag_ui); +} + GList * empathy_import_pidgin_load (void) { - xmlNodePtr rootnode, node, child, setting; + xmlNodePtr rootnode, node, child; xmlParserCtxtPtr ctxt; xmlDocPtr doc; gchar *filename; @@ -310,8 +356,7 @@ /* Other settings */ else if (!tp_strdiff ((gchar *) child->name, PIDGIN_ACCOUNT_TAG_SETTINGS)) - for (setting = child->children; setting; setting = setting->next) - import_dialog_pidgin_parse_setting (data, setting); + import_dialog_pidgin_handle_settings (data, child); } /* If we have the needed settings, add the account data to the list, diff -ur empathy-2.32.0.1/src/empathy-import-utils.c empathy-2.32.0.1.patched//src/empathy-import-utils.c --- empathy-2.32.0.1/src/empathy-import-utils.c 2010-04-15 11:50:42.000000000 +0400 +++ empathy-2.32.0.1.patched//src/empathy-import-utils.c 2010-10-11 15:44:03.000000000 +0400 @@ -40,6 +40,7 @@ data->source = g_strdup (source); data->protocol = NULL; data->connection_manager = NULL; + data->enabled = FALSE; return data; } diff -ur empathy-2.32.0.1/src/empathy-import-utils.h empathy-2.32.0.1.patched//src/empathy-import-utils.h --- empathy-2.32.0.1/src/empathy-import-utils.h 2010-04-15 11:50:42.000000000 +0400 +++ empathy-2.32.0.1.patched//src/empathy-import-utils.h 2010-10-11 15:44:03.000000000 +0400 @@ -37,6 +37,8 @@ gchar *connection_manager; /* The name of the account import source */ gchar *source; + /* Indicates whether the account is enabled by default */ + gboolean enabled; } EmpathyImportAccountData; typedef enum { diff -ur empathy-2.32.0.1/src/empathy-import-widget.c empathy-2.32.0.1.patched//src/empathy-import-widget.c --- empathy-2.32.0.1/src/empathy-import-widget.c 2010-10-04 13:19:27.000000000 +0400 +++ empathy-2.32.0.1.patched//src/empathy-import-widget.c 2010-10-11 15:44:03.000000000 +0400 @@ -167,6 +167,7 @@ GAsyncResult *result, gpointer user_data) { + TpAccountManager *account_manager; TpAccount *account; GError *error = NULL; EmpathyImportWidget *self = user_data; @@ -184,6 +185,13 @@ DEBUG ("account created\n"); + if (tp_account_is_enabled (account)) + { + account_manager = tp_account_manager_dup (); + empathy_connect_new_account (account, account_manager); + g_object_unref (account_manager); + } + g_object_unref (self); } @@ -208,7 +216,8 @@ DEBUG ("display name: %s\n", display_name); - properties = g_hash_table_new (NULL, NULL); + properties = tp_asv_new (NULL, NULL); + tp_asv_set_boolean (properties, TP_IFACE_ACCOUNT ".Enabled", data->enabled); tp_account_manager_create_account_async (account_manager, (const gchar*) data->connection_manager, data->protocol, display_name,