Subject: Re: [sup-devel] Patch: Always try to canonize person name using ContactManager

From: Hamish Downer <[email-masked]>
Date: Mon, 20 Jun 2011 23:43:57 +0100

Excerpts from Tero Tilus's message of Mon Jan 24 23:33:23 +0000 2011:
> Sup has mostly not been using the names defined in contacts.txt when
> displaying messages.  I vaguely remember seeing an issue reported on
> something similar to this.  I became annoyed enough and fixed it.
> 
> Now Person.from_address first tries to find the person using
> ContactManager (if it is instantiated) and falls back to
> Person.new(name, email).

In my search for old patches that have never been applied I came across
this one. Now applied to next.

Hamish

-- 
Hamish Downer <[email-masked]>

Web: http://www.foobacca.co.uk/
GPG: B7C48416
_______________________________________________
Sup-devel mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-devel

---

From: Gregor Hoffleit <[email-masked]>
Date: Tue, 25 Jan 2011 13:55:17 +0100

* Tero Tilus <[email-masked]> [Di Jan 25 00:33:23 +0100 2011]
> ContactManager (if it is instantiated) and falls back to

I guess you saw my report in <[email-masked]>: 

* Gregor Hoffleit <[email-masked]> [Mi Feb 10 22:04:57 +0100 2010]
> I have quite a few contacts that send their mails without a display  
> name, i.e. something like "From: [email-masked]".
>
> Sup does some magic (in Person.from_address) to derive something like a
> display name from the local-part of the e-mail address. That's fine so
> far.
>
> But, if the person is in my list of contacts, I want Sup to show the
> display name definied in the contacts entry. In the above case, that
> might be "John Smith" or "John E. Smith" or whatever. Instead, Sup
> sticks to the display name derived from the local part, "john.smith".
>
> It's especially odd in the detailed header view of the thread-view-mode,
> where Sup resolves and shows the alias, but still sticks to the derived
> display name:
>
>     From: john.smith <[email-masked]> (Johnny Boy)
>
>
> The obvious place to start a fix would be Person.from_address, where
> the (display) name, if missing, is derived from the email address.
>
> I wanted to modify Person.from_address in order to use, in the case of
> an empty display name, the ContactManager, to look up any alias in the
> contact list, but somehow I didn't succeed integrating ContactManager
> in person.rb.
>
> Any better idea? Should I file a bug about this?

Regards,
    Gregor Hoffleit

---

From: Tero Tilus <[email-masked]>
Date: Tue, 25 Jan 2011 01:33:23 +0200

-- 
Tero Tilus ## 050 3635 235 ## http://tero.tilus.net/
_______________________________________________
Sup-devel mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-devel

---

From: Tero Tilus <[email-masked]>
Date: Tue, 25 Jan 2011 23:26:30 +0200

Gregor Hoffleit, 2011-01-25 14:55:
> I guess you saw my report in <[email-masked]>

See!  I wasn't dreaming.  ;)

---

From: Gregor Hoffleit <[email-masked]>
Date: Wed, 10 Feb 2010 22:04:57 +0100

The obvious place to start a fix would be Person.from_address, where the
(display) name, if missing, is derived from the email address.

I wanted to modify Person.from_address in order to use, in the case of
an empty display name, the ContactManager, to look up any alias in the
contact list, but somehow I didn't succeed integrating ContactManager in
person.rb.

Regards,
    Gregor Hoffleit

---

From: Alvaro Herrera <[email-masked]>
Date: Tue, 25 Jan 2011 15:29:39 -0300

> ContactManager (if it is instantiated) and falls back to

I tried this patch -- works great, thanks.

One minor nit, probably material for another patch: the list of names
that's built in the thread index mode doesn't seem to use this
facility, and so when you have a thread that includes several emails
from the same account but inconsistent names, that person is listed more
than once in the "participants" column, with the different names.

(For example I have a thread from Fabian, Fabián, and fabian.martinez
that all come from the same [email-masked] account).

-- 
Álvaro Herrera -- Se vende casa en Ñuñoa: www.portalinmobiliario.com/993147
_______________________________________________
Sup-devel mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-devel

---

From: Tero Tilus <[email-masked]>
Date: Tue, 25 Jan 2011 23:25:03 +0200

Alvaro Herrera, 2011-01-25 20:29:
> One minor nit, probably material for another patch: the list of
> names that's built in the thread index mode doesn't seem to use this
> facility

When message was built from index it bypassed person canonization.
Amended patch attached.

> and so when you have a thread that includes several emails from the
> same account but inconsistent names, that person is listed more than
> once in the "participants" column, with the different names.
> 
> (For example I have a thread from Fabian, Fabián, and
> fabian.martinez that all come from the same
> [email-masked] account).

Actually, this was completely independent of the person canonization
feature.  Thread index mode, when constructing the from-list,
identified authors by name, not by email.  The people not in
contacts.txt and appearing in from fields with varying names were
listed several times.

Attached patch also fixes this.