[geary/wip/714922-multiple-addresses-2] From mar-v-in, read alternate emails as RFC822.MailboxAddress objs



commit 37ad67d4613a644e37aa9b787fd541b7327bd70d
Author: Jim Nelson <jim yorba org>
Date:   Wed Feb 11 13:53:19 2015 -0800

    From mar-v-in, read alternate emails as RFC822.MailboxAddress objs

 src/client/composer/composer-widget.vala |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 0c2a4a8..2ca88ef 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -2277,9 +2277,16 @@ public class ComposerWidget : Gtk.EventBox {
         
         if (account.information.alternate_emails != null) {
             foreach (string alternate_email in account.information.alternate_emails) {
-                // TODO: Allow using other real name (not only mail address)
-                Geary.RFC822.MailboxAddresses addresses = new Geary.RFC822.MailboxAddresses.single(
-                    new Geary.RFC822.MailboxAddress(account.information.real_name, alternate_email));
+                Geary.RFC822.MailboxAddresses addresses =
+                    new Geary.RFC822.MailboxAddresses.from_rfc822_string(alternate_email);
+                if (addresses.size == 0)
+                    continue;
+                
+                if (addresses.size == 1 && Geary.String.is_empty(addresses[0].name)) {
+                    addresses = new Geary.RFC822.MailboxAddresses.single(
+                        new Geary.RFC822.MailboxAddress(account.information.real_name, 
addresses[0].address));
+                }
+                
                 // Displayed in the From dropdown to indicate an "alternate email address"
                 // for an account.  The first printf argument will be the alternate email
                 // address, and the second will be the account's primary email address.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]