2007-06-22 Murray Cumming <murrayc@murrayc.com>
authorMurray Cumming <murrayc@murrayc.com>
Fri, 22 Jun 2007 09:57:08 +0000 (09:57 +0000)
committerMurray Cumming <murrayc@murrayc.com>
Fri, 22 Jun 2007 09:57:08 +0000 (09:57 +0000)
* src/modest-tny-account-store.c: (get_password):
        Use tny_account_set_username() to tell tinymail that the username might
        have changed too. But tinymail ignores this: see projects.maemo.org
        bug #61463.
        * src/modest-ui-actions.c:
        (modest_ui_actions_on_password_requested): Remove the useless attempt to
        reset the connection when changing the username, and improve the comments.
        Save the changed username to gconf at least, so it is used when Modest is
        restarted.

pmo-trunk-r2372

ChangeLog2
src/modest-tny-account-store.c
src/modest-ui-actions.c

index 8314ae4..94ae0c8 100644 (file)
@@ -1,3 +1,15 @@
+2007-06-22  Murray Cumming  <murrayc@murrayc.com>
+
+       * src/modest-tny-account-store.c: (get_password):
+       Use tny_account_set_username() to tell tinymail that the username might 
+       have changed too. But tinymail ignores this: see projects.maemo.org 
+       bug #61463.
+       * src/modest-ui-actions.c:
+       (modest_ui_actions_on_password_requested): Remove the useless attempt to 
+       reset the connection when changing the username, and improve the comments.
+       Save the changed username to gconf at least, so it is used when Modest is 
+       restarted.
+
 2007-06-21  Murray Cumming  <murrayc@murrayc.com>
 
        * src/dbus_api/modest-dbus-callbacks.c: (add_folders_to_list):
index f5da3b4..dacd687 100644 (file)
@@ -381,9 +381,11 @@ get_account_store_for_account (TnyAccount *account)
 
 /* This callback will be called by Tinymail when it needs the password
  * from the user, for instance if the password was not remembered.
+ * It also calls forget_password() before calling this,
+ * so that we clear wrong passwords out of our account settings.
  * Note that TnyAccount here will be the server account. */
 static gchar*
-get_password (TnyAccount *account, const gchar *prompt, gboolean *cancel)
+get_password (TnyAccount *account, const gchar * prompt_not_used, gboolean *cancel)
 {
        /* Initialize the output parameter: */
        if (cancel)
@@ -431,18 +433,25 @@ get_password (TnyAccount *account, const gchar *prompt, gboolean *cancel)
                gboolean remember = FALSE;
                pwd = NULL;
                
-               /* Note that we ignore the returned username here,
-                * because it is enough that it will be stored in gconf 
-                * by the signal handler. */
                g_signal_emit (G_OBJECT(self), signals[PASSWORD_REQUESTED_SIGNAL], 0,
                               account_id, /* server_account_name */
                               &username, &pwd, cancel, &remember);
                
                if (!*cancel) {
-                       if (remember)
+                       /* The password will be returned as the result,
+                        * but we need to tell tinymail about the username too: */
+                       tny_account_set_user (account, username);
+                       
+                       if (remember) {
+                               printf ("%s: Storing username=%s, password=%s\n", 
+                                       __FUNCTION__, username, pwd);
+                               modest_account_mgr_set_string (priv->account_mgr,key,
+                                                              MODEST_ACCOUNT_USERNAME,
+                                                              username, TRUE);
                                modest_account_mgr_set_string (priv->account_mgr,key,
                                                               MODEST_ACCOUNT_PASSWORD,
                                                               pwd, TRUE);
+                       }
                        /* We need to dup the string even knowing that
                           it's already a dup of the contents of an
                           entry, because it if it's wrong, then camel
index 8c0dc41..afa3896 100644 (file)
@@ -2094,12 +2094,8 @@ modest_ui_actions_on_password_requested (TnyAccountStore *account_store,
                        const gboolean username_was_changed = 
                                (strcmp (*username, initial_username) != 0);
                        if (username_was_changed) {
-                               /* To actually use a changed username, 
-                                * we must reset the connection, according to pvanhoof.
-                                * This _might_ be a sensible way to do that: */
-                                TnyDevice *device = modest_runtime_get_device();
-                                tny_device_force_offline (device);
-                                tny_device_force_online (device);
+                               g_warning ("%s: tinymail does not yet support changing the "
+                                       "username in the get_password() callback.\n", __FUNCTION__);
                        }
                }