]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Reply.pm
get rid of unnecessary bytes::length usage
[public-inbox.git] / lib / PublicInbox / Reply.pm
index 8226fdc3c755e9cecb7cc66ee2fb4eae1fc23026..d96fadfc8b3bfc8eec1c8400218a88fa4280f77b 100644 (file)
@@ -9,15 +9,9 @@ use URI::Escape qw/uri_escape_utf8/;
 use PublicInbox::Hval qw(ascii_html obfuscate_addrs mid_href);
 use PublicInbox::Address;
 use PublicInbox::MID qw(mid_clean);
+use PublicInbox::Config;
 
-sub squote_maybe ($) {
-       my ($val) = @_;
-       if ($val =~ m{([^\w@\./,\%\+\-])}) {
-               $val =~ s/(['!])/'\\$1'/g; # '!' for csh
-               return "'$val'";
-       }
-       $val;
-}
+*squote_maybe = \&PublicInbox::Config::squote_maybe;
 
 sub add_addrs {
        my ($to, $cc, @addrs) = @_;
@@ -34,7 +28,7 @@ my $reply_headers = join('|', @reply_headers);
 sub mailto_arg_link {
        my ($ibx, $hdr) = @_;
        my $cc = {}; # everyone else
-       my $to; # this is the From address by defaultq
+       my $to; # this is the From address by default
        my $reply_to_all = 'reply-to-all'; # the only good default :P
        my $reply_to_cfg = $ibx->{replyto};
 
@@ -74,9 +68,11 @@ sub mailto_arg_link {
        my $obfs = $ibx->{obfuscate};
        my $subj = $hdr->header('Subject') || '';
        $subj = "Re: $subj" unless $subj =~ /\bRe:/i;
+       my $subj_raw = $subj;
        my $mid = $hdr->header_raw('Message-ID');
        push @arg, '--in-reply-to='.squote_maybe(mid_clean($mid));
        my $irt = mid_href($mid);
+       add_addrs(\$to, $cc, $ibx->{-primary_address}) unless defined($to);
        delete $cc->{$to};
        if ($obfs) {
                my $arg_to = $to;
@@ -103,6 +99,8 @@ sub mailto_arg_link {
                }
        }
 
+       push @arg, "--subject=".squote_maybe($subj_raw);
+
        # I'm not sure if address obfuscation and mailto: links can
        # be made compatible; and address obfuscation is misguided,
        # anyways.