2007-05-08 Murray Cumming <murrayc@murrayc.com>
+ * src/modest-tny-account-store.c:
+ (modest_tny_account_store_instance_init), (get_password):
+ * src/modest-ui-actions.c:
+ (modest_ui_actions_on_password_requested):
+ Do not store the password in gconf, because this function is called
+ for non-remembered passwords. Actually use the cached (in the hash map)
+ password instead of releasing it.
+ The password will now not be remembered if it is asked via the protected
+ password dialog, as per the UI spec.
+
+2007-05-08 Murray Cumming <murrayc@murrayc.com>
+
* src/modest-defs.h:
* src/modest-account-mgr-helpers.h:
* src/modest-account-mgr-helpers.c:
priv->session = NULL;
priv->device = NULL;
+ /* An in-memory store of passwords,
+ * for passwords that are not remembered in the configuration,
+ * so they need to be asked for from the user once in each session:
+ */
priv->password_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, g_free);
}
"account_store"));
}
-/* This callback will be called by Tinymail when it needs the password.
+/* This callback will be called by Tinymail when it needs the password
+ * from the user, for instance if the password was not remembered.
* Note that TnyAccount here will be the server account. */
static gchar*
get_password (TnyAccount *account, const gchar *prompt, gboolean *cancel)
self = MODEST_TNY_ACCOUNT_STORE (account_store);
priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
- /* TODO: What is this hash for? */
+ /* This hash map stores passwords, including passwords that are not stored in gconf. */
/* is it in the hash? if it's already there, it must be wrong... */
pwd_ptr = (gpointer)&pwd; /* pwd_ptr so the compiler does not complained about
* type-punned ptrs...*/
g_hash_table_insert (priv->password_hash, g_strdup (key), g_strdup(pwd));
} else {
g_hash_table_remove (priv->password_hash, key);
+
+ g_free (pwd);
+ pwd = NULL;
}
g_free (username);
username = NULL;
-
- g_free (pwd);
- pwd = NULL;
-
} else
*cancel = FALSE;
if (password) {
*password = g_strdup (gtk_entry_get_text (GTK_ENTRY(entry_password)));
- /* TODO: It is strange that we must return this as well as set it in gconf.
- * That would only be useful if there was a remember-password preference,
- * but there is no such preference at this time. */
+ /* We do not save the password in the configuration,
+ * because this function is only called for passwords that should
+ * not be remembered:
modest_server_account_set_password (
modest_runtime_get_account_mgr(), server_account_name,
*password);
+ */
}
if (cancel)