initial address decoder filter
authorDavid Bremner <bremner@unb.ca>
Sat, 21 Jun 2008 06:50:17 +0000 (08:50 +0200)
committerDavid Bremner <bremner@unb.ca>
Sat, 21 Jun 2008 06:50:17 +0000 (08:50 +0200)
filters/expand-iki-address.pl [new file with mode: 0644]
filters/test1.eml [new file with mode: 0644]

diff --git a/filters/expand-iki-address.pl b/filters/expand-iki-address.pl
new file mode 100644 (file)
index 0000000..a11e6d9
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use Mail::Internet;
+use Compress::LZF ;
+use MIME::Base64::URLSafe; 
+
+my $prefix="-comment-";
+my $mail = Mail::Internet->new([<>]);
+
+my $to = $mail->get('To:');
+
+if ($to =~ m/$prefix([A-Za-z0-9\-_]+)\@/){
+    my $key=$1;
+    my $page=decompress(urlsafe_b64decode($key));
+    $mail->replace('X-IkiWiki-Page:',$page);
+}
+
+$mail->print(\*STDOUT);
+
+
diff --git a/filters/test1.eml b/filters/test1.eml
new file mode 100644 (file)
index 0000000..2dde8a3
--- /dev/null
@@ -0,0 +1,14 @@
+From: David Bremner <bremner@mailhost.imaginary.org>
+To: bremner-comment-AHNpdGVtYXA@mailhost.imaginary.org
+Subject: I hate your sitemap
+Fcc: %sent-mail
+User-Agent: EMIKO/1.14.1 (Choanoflagellata) FLIM/1.14.9 (=?ISO-8859-4?Q?Go?=
+ =?ISO-8859-4?Q?j=F2?=) APEL/10.7 EasyPG/0.0.15 Emacs/22.2
+ (i486-pc-linux-gnu) MULE/5.0 (SAKAKI)
+MIME-Version: 1.0 (generated by EMIKO 1.14.1 - "Choanoflagellata")
+Content-Type: text/plain; charset=US-ASCII
+
+
+It is stupid.
+
+Why don't you put more work into your blog?