* Fixes NB#85131, show the proper account when opening draft messages
authorSergio Villar Senin <svillar@igalia.com>
Wed, 30 Apr 2008 17:24:40 +0000 (17:24 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Wed, 30 Apr 2008 17:24:40 +0000 (17:24 +0000)
pmo-trunk-r4495

src/modest-ui-actions.c

index fb88cb6..e4f50be 100644 (file)
@@ -945,17 +945,26 @@ open_msg_cb (ModestMailOperation *mail_op,
                if (from_header) {
                        GSList *accounts = modest_account_mgr_account_names (mgr, TRUE);
                        GSList *node = NULL;
                if (from_header) {
                        GSList *accounts = modest_account_mgr_account_names (mgr, TRUE);
                        GSList *node = NULL;
+                       gchar *from_header_email;
+
+                       from_header_email = modest_text_utils_get_email_address ((const gchar *) from_header);
+
                        for (node = accounts; node != NULL; node = g_slist_next (node)) {
                        for (node = accounts; node != NULL; node = g_slist_next (node)) {
-                               gchar *from = modest_account_mgr_get_from_string (mgr, node->data);
+                               gchar *from, *from_email;
                                
                                
-                               if (from && (strcmp (from_header, from) == 0)) {
-                                       g_free (account);
-                                       account = g_strdup (node->data);
+                               from = modest_account_mgr_get_from_string (mgr, node->data);
+                               if (from) {
+                                       from_email = modest_text_utils_get_email_address ((const gchar *) from);
+                                       if (strcmp (from_header_email, from_email) == 0) {
+                                               g_free (account);
+                                               account = g_strdup (node->data);
+                                               g_free (from);
+                                               break;
+                                       }
                                        g_free (from);
                                        g_free (from);
-                                       break;
                                }
                                }
-                               g_free (from);
                        }
                        }
+                       g_free (from_header_email);
                        g_free (from_header);
                        g_slist_foreach (accounts, (GFunc) g_free, NULL);
                        g_slist_free (accounts);
                        g_free (from_header);
                        g_slist_foreach (accounts, (GFunc) g_free, NULL);
                        g_slist_free (accounts);