-}
-
-
-
-/* create a tnyaccount for the server account connected to the account with name 'key'
- */
-static TnyAccount*
-tny_account_from_name (ModestTnyAccountStore *self, const gchar *account,
- const gchar *server_account, ModestProtocolType modest_type)
-{
- TnyAccount *tny_account;
- ModestTnyAccountStorePrivate *priv;
- gchar *val;
- GSList *options = NULL;
- GError *error = NULL;
-
- g_return_val_if_fail (self, NULL);
- g_return_val_if_fail (account, NULL);
- g_return_val_if_fail (server_account, NULL);
-
- priv = MODEST_TNY_ACCOUNT_STORE_GET_PRIVATE(self);
-
- /* is it a store or a transport? */
- if (modest_type == MODEST_PROTOCOL_TYPE_STORE)
- tny_account = TNY_ACCOUNT(tny_camel_store_account_new ());
- else if (modest_type == MODEST_PROTOCOL_TYPE_TRANSPORT)
- tny_account = TNY_ACCOUNT(tny_camel_transport_account_new ());
- else
- g_assert_not_reached ();
-
- if (!tny_account) {
- g_printerr ("modest: failed to create new tny account for '%s:%s'\n",
- account, server_account);
- return NULL;
- }
-
- set_account_store_for_account (TNY_ACCOUNT(tny_account), self);
-
- /* session */
- tny_camel_account_set_session (TNY_CAMEL_ACCOUNT(tny_account),
- priv->tny_session_camel);
-
- /* id */
- tny_account_set_id (tny_account, server_account);
- tny_account_set_name (tny_account, account);
-
- /* proto */
- val = modest_account_mgr_get_string (priv->account_mgr, server_account,
- MODEST_ACCOUNT_PROTO, TRUE, NULL);
- if (val) {
- tny_account_set_proto (tny_account, val);
- g_free (val);
- } else {
- g_printerr ("modest: protocol not defined for '%s:%s'\n",
- account, server_account);
- g_object_unref (G_OBJECT(tny_account));
- return NULL;
+ key = tny_account_get_id (account);
+
+ /* Do not remove the key, this will allow us to detect that we
+ have already asked for it at least once */
+ pwd = g_hash_table_lookup (priv->password_hash, key);
+ if (pwd) {
+ memset (pwd, 0, strlen (pwd));
+ g_hash_table_insert (priv->password_hash, g_strdup (key), NULL);