--- qmail-scanner-2.01/qmail-scanner-queue.template	2006-04-04 02:00:17.000000000 +0000
+++ hashcash-patch/qmail-scanner-queue.template	2007-05-30 22:21:12.000000000 +0000
@@ -1417,6 +1417,29 @@
   my($sender,$env_recips,$msg)=@_;
   my ($temp,$findate);
 
+  # This is the first version of hashcash that is still in testing
+  my $dohashcash = "1";
+  my $addhashcashheader = "1";  
+  my $hashcashcmd = "/usr/bin/hashcash -m -X ";
+  my $hashheaders = "";
+
+  if ($dohashcash) {
+     &debug("Starting HASHCASH creation function");
+
+     #compute hashcash for all addresses that are not bound for this server
+     my ($hashaddr,$addr,$dom) = "";     
+     # is this a safe way to split?  It works so far for my testcases...
+     my @addrlist = split(/,/, $recips);  
+     foreach $addr (@addrlist) {
+        foreach $dom (@local_domains_array) {         
+         if (!($addr =~ /$dom$/i)) {          
+           $hashheaders .= `$hashcashcmd $addr`;
+         }
+       }
+     }
+     &debug("HASHCASH headers: $hashheaders");
+  }
+
   &debug("q_r: fork off child into $qmailqueue...");
   
   #($recips=$env_recips) =~ s/^T//;
@@ -1454,6 +1477,7 @@
     $elapsed_time = tv_interval ($start_time, [gettimeofday]);
     $findate = POSIX::strftime( "%d %b ",$sec,$min,$hour,$mday,$mon,$year);
     $findate .= sprintf "%02d %02d:%02d:%02d -0000", $year+1900, $hour, $min, $sec;
+    print QMQ "$hashheaders\n";
     print QMQ "Received: from $remote_smtp_ip$remote_smtp_auth by $hostname (envelope-from <$returnpath>, uid $real_uid) with qmail-scanner-$VERSION \n";
     print QMQ " ($SCANINFO \n Clear:$tag_score. \n";
     print QMQ " Processed in $elapsed_time secs); $findate\n";
