diff options
Diffstat (limited to 'src/empathy-auto-salut-account-helper.c')
-rw-r--r-- | src/empathy-auto-salut-account-helper.c | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/src/empathy-auto-salut-account-helper.c b/src/empathy-auto-salut-account-helper.c index 85ead8ef6..a5fbcf0c3 100644 --- a/src/empathy-auto-salut-account-helper.c +++ b/src/empathy-auto-salut-account-helper.c @@ -79,30 +79,6 @@ should_create_salut_account (TpAccountManager *manager) return !salut_created; } -static void -salut_account_created (GObject *source, - GAsyncResult *result, - gpointer user_data) -{ - EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source); - TpAccount *account; - GError *error = NULL; - - if (!empathy_account_settings_apply_finish (settings, result, &error)) - { - DEBUG ("Failed to create salut account: %s", error->message); - g_error_free (error); - return; - } - - account = empathy_account_settings_get_account (settings); - - tp_account_set_enabled_async (account, TRUE, NULL, NULL); - empathy_conf_set_bool (empathy_conf_get (), - EMPATHY_PREFS_SALUT_ACCOUNT_CREATED, - TRUE); -} - EmpathyAccountSettings * create_salut_account_settings (void) { @@ -163,88 +139,3 @@ create_salut_account_settings (void) return settings; } - -static void -create_salut_account_am_ready_cb (GObject *source_object, - GAsyncResult *result, - gpointer user_data) -{ - TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object); - EmpathyConnectionManagers *managers = user_data; - EmpathyAccountSettings *settings; - TpConnectionManager *manager; - const TpConnectionManagerProtocol *protocol; - GError *error = NULL; - - if (!tp_account_manager_prepare_finish (account_manager, result, &error)) - { - DEBUG ("Failed to prepare account manager: %s", error->message); - g_error_free (error); - goto out; - } - - if (!should_create_salut_account (account_manager)) - goto out; - - manager = empathy_connection_managers_get_cm (managers, "salut"); - if (manager == NULL) - { - DEBUG ("Salut not installed, not making a salut account"); - goto out; - } - - protocol = tp_connection_manager_get_protocol (manager, "local-xmpp"); - if (protocol == NULL) - { - DEBUG ("Salut doesn't support local-xmpp!!"); - goto out; - } - - DEBUG ("Trying to add a salut account..."); - - settings = create_salut_account_settings (); - if (!empathy_account_settings_is_valid (settings)) - { - g_object_unref (settings); - goto out; - } - - empathy_account_settings_apply_async (settings, - salut_account_created, NULL); - - g_object_unref (settings); - -out: - g_object_unref (managers); -} - -static void -create_salut_account_cms_ready_cb (EmpathyConnectionManagers *managers) -{ - TpAccountManager *manager; - - manager = tp_account_manager_dup (); - - tp_account_manager_prepare_async (manager, NULL, - create_salut_account_am_ready_cb, managers); - - g_object_unref (manager); -} - -void -create_salut_account_if_needed (void) -{ - EmpathyConnectionManagers *managers; - - managers = empathy_connection_managers_dup_singleton (); - - if (empathy_connection_managers_is_ready (managers)) - { - create_salut_account_cms_ready_cb (managers); - } - else - { - g_signal_connect (managers, "notify::ready", - G_CALLBACK (create_salut_account_cms_ready_cb), NULL); - } -} |