Ticket #26 (accepted enhancement)

Opened 2 years ago

Last modified 5 months ago

Parsing of From header

Reported by: zeborah Owned by: ajk
Priority: minor Milestone: Future releases
Component: HTTP Keywords:
Cc: Sensitive: no

Description

Parse the From header into two strings eg $article.username$ and $article.email$.

If I understand correctly, currently $article.from$ takes the From header and displays it as normal when the viewer is logged in, or with the email munged if they're logged out.

If it was instead broken into two strings (look for the at and take anything around it that's a-Z, 0-9, or . as the email address; throw out surrounding punctuation/spaces; and what's left over is the username?) then how they display could be determined with more control by the template, eg

  • username alone if logged out
  • username with mailto link if logged in
  • use the email address to access and display a gravatar ( http://www.gravatar.com/)

Attachments

Change History

Changed 2 years ago by ajk

  • status changed from new to accepted

From can be parsed using its formal structure as a guide. However, the structure isn't as simple as you think. A From line may (but rarely does) contain more than one name–email-address pair, so we'd have a list of from-entities. Each from-entity in turn may contain a name, and always contains an address; sometimes the name is included as a "comment", which a formal parser should (theoretically throw away). So:

From: Antti-Juhani Kaijanaho <antti-juhani@kaijanaho.fi>, zeborah@gmail.com (Zeborah)

would be parsed as two authors, one of whom has a name and the other does not (the parenthetical part is formally a comment).

So you can probably see why I didn't add that parsing code early on. I did consider it. But yeah, it's something to do eventually, but not using the heuristics you suggest.

Thanks for the report.

Add/Change #26 (Parsing of From header)

Author


E-mail address and user name can be saved in the Preferences.


Action
as accepted
 
Note: See TracTickets for help on using tickets.