commit 6c6960ea3644cde3326d9d4d5fc4b46d9ff9aa22 from: Caleb Stein date: Thu Apr 30 09:46:32 2026 UTC initial commit commit - /dev/null commit + 6c6960ea3644cde3326d9d4d5fc4b46d9ff9aa22 blob - /dev/null blob + fcd02734a810363b5689f02eb898d9e7a805711f (mode 755) --- /dev/null +++ maillink.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl + +use strict; + +my $line = $ARGV[0]; + +open(my $fh, '<', "$ENV{HOME}/.maillinks") or die "Could not open .maillinks!"; +while (<$fh>) +{ + next if ($. != $line); + + print $_; + last; +} +close($fh); blob - /dev/null blob + ee0644278c6f2840d6c5699c94ec8bda0d5055ed (mode 755) --- /dev/null +++ mailread.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use strict; +use IPC::Run3; + +my $content = do { local $/; <> }; +my $ishtml = qr/< *(html|head|body|div|table|p|span|br) *\/?>/; +my @links; + +run3(['lynx', '-dump', '-force_html', '-stdin'], \$content, \$content, undef) if ($content =~ $ishtml); +$content =~ s{(https?://[^\s<>"]+)}{ + if (length($1) > 80) { + "[Link #" . (push @links, $1) . "]"; + } else { + $1; + } +}gex; + +if ($#links > 0) +{ + open(my $fh, '>', "$ENV{HOME}/.maillinks"); + foreach my $link (@links) + { + print $fh "$link\n" + } + close $fh; +} + +print $content; +