+ PwdAttempt *new_attempt = g_slice_new0 (PwdAttempt);
+ new_attempt->count = RETRY_ATTEMPTS;
+ new_attempt->pwd = g_strdup (pwd);
+ g_hash_table_insert (priv->password_hash, g_strdup (server_account_name), new_attempt);
+ } else if (attempt) {
+ pwd = g_strdup (attempt->pwd);
+ }
+
+ /* This is horrible but we need it until we don't get a proper
+ fix into tinymail. Thing is that tinymail incorrectly asks
+ for password when the connection to the server failed due a
+ timeout (slow network connection, firewalls...). In those
+ cases it makes no sense to ask the user. It's better just
+ to cancel cleanly */
+ if (g_strstr_len (prompt_not_used, -1, "Connection timed out")) {
+ g_debug ("%s, Incorrect get_password with connection issue %s",
+ __FUNCTION__, (attempt && (attempt->count > 0)) ? "retrying" : "canceling");
+ if (attempt) {
+ if (attempt->count == 0) {
+ modest_tny_account_store_reset_attempt_count (self, account);
+ if (cancel)
+ *cancel = TRUE;
+ return NULL;
+ } else {
+ return pwd;
+ }
+ } else {
+ if (cancel)
+ *cancel = TRUE;
+ return NULL;
+ }