[geary] Use quoted RFC822 string when autocompleting address: Bug #714956
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Use quoted RFC822 string when autocompleting address: Bug #714956
- Date: Fri, 25 Jul 2014 20:28:25 +0000 (UTC)
commit 1398cccfb1add8a889843f0e74a5e77d53bed4b5
Author: Jim Nelson <jim yorba org>
Date: Fri Jul 25 13:23:00 2014 -0700
Use quoted RFC822 string when autocompleting address: Bug #714956
Autocomplete now uses a properly-quoted RFC822 string when an address
is selected from the drop-down list. This resolves the most egregious
case of the composer not accepting an email address formatted
[Last, First <mailbox host>], as autocomplete is heavily relied-upon
and Geary is presenting an address that can't be used, which is
confusing.
It's still possible for the user to manually enter such an address w/o
quotes (either typing or pasting it in). However, this seems like a
far less problematic use case. The ticket remains open due to this,
however.
Finally, some comments have been added to clarify the difference
between RFC822.MailboxAddress.get_full_address() and
to_rfc822_string(). I've also done a code-review to check that both
methods are being used correctly elsewhere in the code.
src/client/composer/contact-entry-completion.vala | 4 ++--
src/client/composer/contact-list-store.vala | 6 +++---
src/engine/rfc822/rfc822-mailbox-address.vala | 10 +++++++++-
3 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/client/composer/contact-entry-completion.vala
b/src/client/composer/contact-entry-completion.vala
index 1aef63a..4b0d029 100644
--- a/src/client/composer/contact-entry-completion.vala
+++ b/src/client/composer/contact-entry-completion.vala
@@ -24,8 +24,8 @@ public class ContactEntryCompletion : Gtk.EntryCompletion {
}
private bool on_match_selected(Gtk.EntryCompletion sender, Gtk.TreeModel model, Gtk.TreeIter iter) {
- string full_address = list_store.get_full_address(iter);
-
+ string full_address = list_store.get_rfc822_string(iter);
+
Gtk.Entry? entry = sender.get_entry() as Gtk.Entry;
if (entry == null)
return false;
diff --git a/src/client/composer/contact-list-store.vala b/src/client/composer/contact-list-store.vala
index 4d5e433..b83870c 100644
--- a/src/client/composer/contact-list-store.vala
+++ b/src/client/composer/contact-list-store.vala
@@ -52,8 +52,8 @@ public class ContactListStore : Gtk.ListStore {
return (Geary.Contact) contact_value.get_object();
}
- public string get_full_address(Gtk.TreeIter iter) {
- return get_contact(iter).get_rfc822_address().get_full_address();
+ public string get_rfc822_string(Gtk.TreeIter iter) {
+ return get_contact(iter).get_rfc822_address().to_rfc822_string();
}
// Highlighted result should be Markup.escaped for presentation to the user
@@ -78,7 +78,7 @@ public class ContactListStore : Gtk.ListStore {
if (contact.highest_importance < CONTACT_VISIBILITY_THRESHOLD)
return;
- string full_address = contact.get_rfc822_address().get_full_address();
+ string full_address = contact.get_rfc822_address().to_rfc822_string();
Gtk.TreeIter iter;
append(out iter);
set(iter,
diff --git a/src/engine/rfc822/rfc822-mailbox-address.vala b/src/engine/rfc822/rfc822-mailbox-address.vala
index 354d8cc..a4b9309 100644
--- a/src/engine/rfc822/rfc822-mailbox-address.vala
+++ b/src/engine/rfc822/rfc822-mailbox-address.vala
@@ -67,7 +67,9 @@ public class Geary.RFC822.MailboxAddress : Geary.MessageData.SearchableMessageDa
/**
* Returns a human-readable formatted address, showing the name (if available) and the email
- * address in angled brackets.
+ * address in angled brackets. No RFC822 quoting is performed.
+ *
+ * @see to_rfc822_string
*/
public string get_full_address() {
return String.is_empty(name) ? address : "%s <%s>".printf(name, address);
@@ -120,6 +122,12 @@ public class Geary.RFC822.MailboxAddress : Geary.MessageData.SearchableMessageDa
return address.normalize().casefold();
}
+ /**
+ * Returns the address suitable for insertion into an RFC822 message. RFC822 quoting is
+ * performed if required.
+ *
+ * @see get_full_address
+ */
public string to_rfc822_string() {
return String.is_empty(name)
? address
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]