summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
59b3f75)
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.
+ 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};
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) {
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";
# 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";
}
my ($arg, $link) = PublicInbox::Reply::mailto_arg_link($ibx, $hdr);
}
my ($arg, $link) = PublicInbox::Reply::mailto_arg_link($ibx, $hdr);
+
+ # mailto: link only works if address obfuscation is disabled
+ if ($link) {
+ $link = <<EOF;
+* If your mail client supports setting the <b>In-Reply-To</b> header
+ via mailto: links, try the <a
+href="$link">mailto: link</a></pre>
+EOF
+ }
push @$arg, '/path/to/YOUR_REPLY';
$arg = ascii_html(join(" \\\n ", '', @$arg));
<<EOF
push @$arg, '/path/to/YOUR_REPLY';
$arg = ascii_html(join(" \\\n ", '', @$arg));
<<EOF
<a
href="$se_url">$se_url</a>
<a
href="$se_url">$se_url</a>
-
-* If your mail client supports setting the <b>In-Reply-To</b> header
- via mailto: links, try the <a
-href="$link">mailto: link</a></pre>
$exp = [ '--in-reply-to=blah@example.com', '--to=new@example.com' ];
is_deeply($arg, $exp, 'explicit address works, too');
$exp = [ '--in-reply-to=blah@example.com', '--to=new@example.com' ];
is_deeply($arg, $exp, 'explicit address works, too');
+$ibx->{replyto} = ':all';
+$ibx->{obfuscate} = 1;
+($arg, $link) = PublicInbox::Reply::mailto_arg_link($ibx, $hdr);
+$exp = [
+ '--in-reply-to=blah@example.com',
+ '--to=from@example$(echo .)com',
+ '--cc=cc@example$(echo .)com',
+ '--cc=to@example$(echo .)com'
+];
+is_deeply($arg, $exp, 'address obfuscation works');
+is($link, '', 'no mailto: link given');
+