diff options
author | Eric Wong <e@80x24.org> | 2017-06-23 02:25:33 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-06-23 02:32:35 +0000 |
commit | 666844ae42b5b17fd2e9b7ea6cf04727487b5322 (patch) | |
tree | 887824678cd482404c8f4b789eae1ed29114c1c4 /lib/PublicInbox/Reply.pm | |
parent | 59b3f7584817735a69b45388fd2d4c40750cf6e4 (diff) | |
download | public-inbox-666844ae42b5b17fd2e9b7ea6cf04727487b5322.tar.gz |
reply: handle address obfuscation :<
We can show users a lightly-obfuscated Bourne shell command for invoking "git send-email" for address obfuscation. However, I'm not sure if the mailto: arg will work effectively since URL encoding is probably too well-known to be effective.
Diffstat (limited to 'lib/PublicInbox/Reply.pm')
-rw-r--r-- | lib/PublicInbox/Reply.pm | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/lib/PublicInbox/Reply.pm b/lib/PublicInbox/Reply.pm index 13ae052e..0cd36fda 100644 --- a/lib/PublicInbox/Reply.pm +++ b/lib/PublicInbox/Reply.pm @@ -58,22 +58,41 @@ sub mailto_arg_link { } my @arg; + my $obfs = $ibx->{obfuscate}; my $subj = $hdr->header('Subject') || ''; $subj = "Re: $subj" unless $subj =~ /\bRe:/i; my $mid = $hdr->header_raw('Message-ID'); push @arg, '--in-reply-to='.squote_maybe(mid_clean($mid)); my $irt = mid_escape($mid); delete $cc->{$to}; - push @arg, "--to=$to"; - $to = uri_escape_utf8($to); - $subj = uri_escape_utf8($subj); + if ($obfs) { + my $arg_to = $to; + $arg_to =~ s/\./\$(echo .)/; + push @arg, "--to=$arg_to"; + } else { + push @arg, "--to=$to"; + $to = uri_escape_utf8($to); + $subj = uri_escape_utf8($subj); + } my @cc = sort values %$cc; $cc = ''; if (@cc) { - push(@arg, map { "--cc=$_" } @cc); - $cc = '&Cc=' . uri_escape_utf8(join(',', @cc)); + if ($obfs) { + push(@arg, map { + s/\./\$(echo .)/; + "--cc=$_"; + } @cc); + } else { + $cc = '&Cc=' . uri_escape_utf8(join(',', @cc)); + push(@arg, map { "--cc=$_" } @cc); + } } + # I'm not sure if address obfuscation and mailto: links can + # be made compatible; and address obfuscation is misguided, + # anyways. + return (\@arg, '') if $obfs; + # order matters, Subject is the least important header, # so it is last in case it's lost/truncated in a copy+paste my $href = "mailto:$to?In-Reply-To=$irt${cc}&Subject=$subj"; |