about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-25 10:56:59 +0000
committerEric Wong <e@80x24.org>2016-06-25 10:56:59 +0000
commit13eda978e8937065575623d045f78592cbb6d022 (patch)
tree34dea0c86802f8808b18a2d70fafb5f23000c740 /lib/PublicInbox
parentdde6d1169d8f9d6aaede9730144d1f60be2134c8 (diff)
downloadpublic-inbox-13eda978e8937065575623d045f78592cbb6d022.tar.gz
Address::names is sufficient to handle what from_name did.
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/Address.pm14
-rw-r--r--lib/PublicInbox/Feed.pm2
-rw-r--r--lib/PublicInbox/SearchMsg.pm3
-rw-r--r--lib/PublicInbox/View.pm4
4 files changed, 5 insertions, 18 deletions
diff --git a/lib/PublicInbox/Address.pm b/lib/PublicInbox/Address.pm
index abba43d1..cd5fbfbe 100644
--- a/lib/PublicInbox/Address.pm
+++ b/lib/PublicInbox/Address.pm
@@ -20,18 +20,4 @@ sub names {
         } split(/\@+[\w\.\-]+>?\s*(?:,\s*|\z)/, $_[0]);
 }
 
-sub from_name {
-        my ($val) = @_;
-        my $name = $val;
-        $name =~ s/\s*\S+\@\S+\s*\z//;
-        if ($name !~ /\S/ || $name =~ /[<>]/) { # git does not like [<>]
-                ($name) = emails($val);
-                $name =~ s/\@.*//;
-        }
-        $name =~ tr/\r\n\t/ /;
-        $name =~ s/\A['"\s]*//;
-        $name =~ s/['"\s]*\z//;
-        $name;
-}
-
 1;
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index 455b8e23..8e233061 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -317,7 +317,7 @@ sub feed_entry {
 
         my $from = $header_obj->header('From') or return;
         my ($email) = PublicInbox::Address::emails($from);
-        my $name = PublicInbox::Address::from_name($from);
+        my $name = join(', ',PublicInbox::Address::names($from));
         $name = ascii_html($name);
         $email = ascii_html($email);
 
diff --git a/lib/PublicInbox/SearchMsg.pm b/lib/PublicInbox/SearchMsg.pm
index d41d2439..4b0b645e 100644
--- a/lib/PublicInbox/SearchMsg.pm
+++ b/lib/PublicInbox/SearchMsg.pm
@@ -85,7 +85,8 @@ sub from ($) {
         my ($self) = @_;
         my $from = __hdr($self, 'from');
         if (defined $from && !defined $self->{from_name}) {
-                $self->{from_name} = PublicInbox::Address::from_name($from);
+                my @n = PublicInbox::Address::names($from);
+                $self->{from_name} = join(', ', @n);
         }
         $from;
 }
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index d906276a..30d8e3e8 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -354,8 +354,8 @@ sub _msg_html_prepare {
                 $v = PublicInbox::Hval->new($v);
 
                 if ($h eq 'From') {
-                        my $n = PublicInbox::Address::from_name($v->raw);
-                        $title[1] = ascii_html($n);
+                        my @n = PublicInbox::Address::names($v->raw);
+                        $title[1] = ascii_html(join(', ', @n));
                 } elsif ($h eq 'Subject') {
                         $title[0] = $v->as_html;
                         if ($srch) {