Fixed NB#89126:
authorJose Dapena Paz <jdapena@igalia.com>
Fri, 10 Oct 2008 13:04:42 +0000 (13:04 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Fri, 10 Oct 2008 13:04:42 +0000 (13:04 +0000)
* Now we use the active account for setting the from field on creating
  new messages in hildon2 port.
* A small fix in the code that finds the account of a from string to
  make "from:" account detection a bit better.

pmo-trunk-r6003

src/modest-ui-actions.c
src/modest-utils.c

index 7d3ec7e..6a5a9b6 100644 (file)
@@ -715,7 +715,12 @@ modest_ui_actions_compose_msg(ModestWindow *win,
        if (attachments && modest_platform_check_memory_low (win, TRUE))
                goto cleanup;
 
        if (attachments && modest_platform_check_memory_low (win, TRUE))
                goto cleanup;
 
-       account_name = modest_account_mgr_get_default_account(mgr);
+#ifdef MODEST_TOOLKIT_HILDON2
+       account_name = g_strdup (modest_window_get_active_account(win));
+#endif
+       if (!account_name) {
+               account_name = modest_account_mgr_get_default_account(mgr);
+       }
        if (!account_name) {
                g_printerr ("modest: no account found\n");
                goto cleanup;
        if (!account_name) {
                g_printerr ("modest: no account found\n");
                goto cleanup;
index fb7089d..aceeafb 100644 (file)
@@ -764,16 +764,19 @@ modest_utils_get_account_name_from_recipient (const gchar *from_header)
                if (from) {
                        gchar *from_email = 
                                modest_text_utils_get_email_address (from);
                if (from) {
                        gchar *from_email = 
                                modest_text_utils_get_email_address (from);
+                       gchar *from_header_email =
+                               modest_text_utils_get_email_address (from_header);
                                
                                
-                       if (from_email) {
-                               if (!modest_text_utils_utf8_strcmp (from_header, from_email, TRUE)) {
+                       if (from_email && from_header_email) {
+                               if (!modest_text_utils_utf8_strcmp (from_header_email, from_email, TRUE)) {
                                        account_name = g_strdup (node->data);
                                        g_free (from);
                                        g_free (from_email);
                                        break;
                                }
                                        account_name = g_strdup (node->data);
                                        g_free (from);
                                        g_free (from_email);
                                        break;
                                }
-                               g_free (from_email);
                        }
                        }
+                       g_free (from_email);
+                       g_free (from_header_email);
                        g_free (from);
                }
        }
                        g_free (from);
                }
        }