Parse address names listed Last, First for short participant names: Closes #5687

This catches reversed names when generating short participant names
(where Geary generally only shows the first name).
This commit is contained in:
Tiago Quelhas 2013-01-07 19:27:52 -08:00 committed by Jim Nelson
parent d5c026b241
commit 9a34d54975
2 changed files with 13 additions and 2 deletions

1
THANKS
View file

@ -12,6 +12,7 @@ Charles Lindsay <chaz@yorba.org>
Thomas Moschny <thomas.moschny@gmx.de>
Robert Park <rbpark@exolucere.ca>
Mario Sanchez Prada <msanchez@igalia.com>
Tiago Quelhas <tiagoq@gmail.com>
Didier Roche <didrocks@ubuntu.com>
Michel Alexandre Salim <salimma@fedoraproject.org>
Robert Schroll <rschroll@gmail.com>

View file

@ -38,8 +38,18 @@ public class FormattedConversationData : Object {
if (key == normalized_account_key)
return get_as_markup(ME);
// Using simplified algorithm: first name as delimited by a space
string[] tokens = address.get_short_address().strip().split(" ", 2);
string short_address = address.get_short_address().strip();
if (", " in short_address) {
// assume address is in Last, First format
string[] tokens = short_address.split(", ", 2);
short_address = tokens[1].strip();
if (Geary.String.is_empty(short_address))
return get_full_markup(normalized_account_key);
}
// use first name as delimited by a space
string[] tokens = short_address.split(" ", 2);
if (tokens.length < 1)
return get_full_markup(normalized_account_key);