#include <config.h>
#include <glib.h>
-#include <glib/gi18n-lib.h>
-#include <modest-default-connection-policy.h>
+#include "modest-default-connection-policy.h"
+#include "modest-account-mgr-helpers.h"
+#include "modest-runtime.h"
#include <tny-account.h>
+#include <tny-store-account.h>
static GObjectClass *parent_class = NULL;
static void
modest_default_connection_policy_on_connect (TnyConnectionPolicy *self, TnyAccount *account)
{
+ /* Set the username as succedded */
+ if (TNY_IS_STORE_ACCOUNT (account))
+ modest_account_mgr_set_server_account_username_has_succeeded (modest_runtime_get_account_mgr (),
+ tny_account_get_id (account),
+ TRUE);
+
return;
}
ModestAccountMgr *mgr;
ModestAccountRetrieveType retrieve_type;
TnyList *new_headers = NULL;
- gboolean headers_only, ignore_limit, succeeded;
+ gboolean headers_only, ignore_limit;
TnyTransportAccount *transport_account = NULL;
info = (UpdateAccountInfo *) user_data;
/* Update the last updated key, even if we don't have to get new headers */
modest_account_mgr_set_last_updated (mgr, tny_account_get_id (priv->account), time (NULL));
- if (!canceled && !err)
- modest_account_mgr_set_server_account_username_has_succeeded (mgr, tny_account_get_id (priv->account), TRUE);
if (new_headers_array->len == 0)
goto send_mail;
g_ptr_array_foreach (new_headers_array, (GFunc) g_object_unref, NULL);
g_ptr_array_free (new_headers_array, FALSE);
- if (priv->error)
- succeeded = FALSE;
- else
- succeeded = TRUE;
- modest_account_mgr_set_server_account_username_has_succeeded (modest_runtime_get_account_mgr (),
- tny_account_get_name (priv->account),
- succeeded);
send_mail:
/* Get the transport account */
transport_account = (TnyTransportAccount *)
}
static void
-show_password_warning_only ()
+show_password_warning_only (const gchar *msg)
{
ModestWindow *main_window =
modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (), FALSE); /* don't create */
/* Show an explanatory temporary banner: */
if (main_window)
- modest_platform_information_banner (NULL, NULL,
- _("mcen_ib_username_pw_incorrect"));
- else
- g_warning ("%s: %s", __FUNCTION__, _("mcen_ib_username_pw_incorrect"));
+ modest_platform_information_banner (NULL, NULL, msg);
}
static void
pwd = NULL;
if (already_asked) {
- /* Show an info banner, before we show the protected password dialog: */
- show_password_warning_only();
+ const gchar *msg;
+ gboolean username_known =
+ modest_account_mgr_get_server_account_username_has_succeeded(priv->account_mgr,
+ server_account_name);
+ /* If the login has ever succeeded then show a specific message */
+ if (username_known)
+ msg = _("ecdg_ib_set_password_incorrect");
+ else
+ msg = _("mcen_ib_username_pw_incorrect");
+ show_password_warning_only (msg);
}
/* Request password */
TnyConnectionStatus status,
gpointer data)
{
+ /* We do this here and not in the connection policy because we
+ don't want to do it for every account, just for the
+ accounts that are interactively added when modest is
+ runnning */
if (status == TNY_CONNECTION_STATUS_CONNECTED) {
const gchar *account_name;
ModestWindow *main_window;
G_OBJECT (account),
"connection_status_changed");
- /* Set the username as succedded */
- modest_account_mgr_set_server_account_username_has_succeeded (modest_runtime_get_account_mgr (),
- tny_account_get_id (account),
- TRUE);
-
/* Perform a send receive */
account_name = modest_tny_account_get_parent_modest_account_name_for_server_account (account);
main_window = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr (), FALSE);