]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-account-settings.c
debug-window: fix typo
[empathy.git] / libempathy / empathy-account-settings.c
index 40cfdb472a14f5b66720e030a574b35c10e1c16f..12b28b8ba245dd9eee6d549b50467aa8040198ea 100644 (file)
 
 #include "config.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <telepathy-glib/account-manager.h>
-#include <telepathy-glib/util.h>
-#include <telepathy-glib/interfaces.h>
-#include <telepathy-glib/gtypes.h>
-
 #include "empathy-account-settings.h"
 #include "empathy-connection-managers.h"
 #include "empathy-keyring.h"
@@ -76,11 +68,12 @@ struct _EmpathyAccountSettingsPriv
   gchar *service;
   gchar *display_name;
   gchar *icon_name;
+  gchar *storage_provider;
   gboolean display_name_overridden;
   gboolean ready;
 
   gboolean supports_sasl;
-  gboolean password_changed;
+  gboolean remember_password;
 
   gchar *password;
   gchar *password_original;
@@ -397,6 +390,7 @@ empathy_account_settings_finalize (GObject *object)
   g_free (priv->icon_name);
   g_free (priv->password);
   g_free (priv->password_original);
+  g_free (priv->storage_provider);
 
   if (priv->required_params != NULL)
     {
@@ -830,7 +824,6 @@ empathy_account_settings_unset (EmpathyAccountSettings *settings,
     {
       g_free (priv->password);
       priv->password = NULL;
-      priv->password_changed = TRUE;
       return;
     }
 
@@ -848,7 +841,6 @@ empathy_account_settings_discard_changes (EmpathyAccountSettings *settings)
   g_hash_table_remove_all (priv->parameters);
   empathy_account_settings_free_unset_parameters (settings);
 
-  priv->password_changed = FALSE;
   g_free (priv->password);
   priv->password = g_strdup (priv->password_original);
 
@@ -1070,7 +1062,6 @@ empathy_account_settings_set (EmpathyAccountSettings *settings,
     {
       g_free (priv->password);
       priv->password = g_variant_dup_string (v, NULL);
-      priv->password_changed = TRUE;
     }
   else
     {
@@ -1333,16 +1324,22 @@ empathy_account_settings_account_updated (GObject *source,
       goto out;
     }
 
-  /* Only set the password in the keyring if the CM supports SASL and
-   * it's changed. */
-  if (priv->supports_sasl && priv->password_changed)
+  update_account_uri_schemes (settings);
+  update_account_service (settings);
+
+  g_simple_async_result_set_op_res_gboolean (priv->apply_result,
+      g_strv_length (reconnect_required) > 0);
+
+  /* Only set the password in the keyring if the CM supports SASL. */
+  if (priv->supports_sasl)
     {
       if (priv->password != NULL)
         {
           /* FIXME: we shouldn't save the password if we
            * can't (MaySaveResponse=False) but we don't have API to check that
            * at this point (fdo #35382). */
-          empathy_keyring_set_account_password_async (priv->account, priv->password,
+          empathy_keyring_set_account_password_async (priv->account,
+              priv->password, priv->remember_password,
               empathy_account_settings_set_password_cb, settings);
         }
       else
@@ -1354,12 +1351,6 @@ empathy_account_settings_account_updated (GObject *source,
       return;
     }
 
-  update_account_uri_schemes (settings);
-  update_account_service (settings);
-
-  g_simple_async_result_set_op_res_gboolean (priv->apply_result,
-      g_strv_length (reconnect_required) > 0);
-
 out:
   empathy_account_settings_discard_changes (settings);
 
@@ -1397,7 +1388,8 @@ empathy_account_settings_created_cb (GObject *source,
            * can't (MaySaveResponse=False) but we don't have API to check that
            * at this point (fdo #35382). */
           empathy_keyring_set_account_password_async (priv->account,
-              priv->password, empathy_account_settings_set_password_cb,
+              priv->password, priv->remember_password,
+              empathy_account_settings_set_password_cb,
               settings);
           return;
         }
@@ -1456,6 +1448,12 @@ empathy_account_settings_do_create_account (EmpathyAccountSettings *self)
       tp_account_request_set_parameter (account_req, key, value);
     }
 
+  if (priv->storage_provider != NULL)
+    {
+      tp_account_request_set_storage_provider (account_req,
+          priv->storage_provider);
+    }
+
   tp_account_request_create_account_async (account_req,
       empathy_account_settings_created_cb, self);
 }
@@ -1708,3 +1706,22 @@ empathy_account_settings_has_uri_scheme_tel (
 
   return priv->uri_scheme_tel;
 }
+
+void
+empathy_account_settings_set_storage_provider (EmpathyAccountSettings *self,
+    const gchar *storage)
+{
+  EmpathyAccountSettingsPriv *priv = GET_PRIV (self);
+
+  g_free (priv->storage_provider);
+  priv->storage_provider = g_strdup (storage);
+}
+
+void
+empathy_account_settings_set_remember_password (EmpathyAccountSettings *self,
+    gboolean remember)
+{
+  EmpathyAccountSettingsPriv *priv = GET_PRIV (self);
+
+  priv->remember_password = remember;
+}