#!/usr/bin/env perl
 
use News::Article::Cancel;
use strict;
my $article = News::Article::Cancel->new(\*STDIN);
my $pattern = shift || ".*";

my @from;
foreach my $string ( $article->header('x-auth'), $article->header('x-signature') ) {
  if ($string =~ /^ PGPMoose \s+ V\d\.\d \s+ PGP \s+ (\S+) \n /isx ) { 
    push @from, $1; 
  }
}

$article->rename_header('x-signature', 'x-auth', 'add');

foreach (@from, split(',', $article->header('newsgroups'))) {
  next unless /^$pattern$/;
  my $answer = $article->verify_pgpmoose($_);
     $answer ||= $article->verify_resurrected($_);
  print $answer ? "Signed for $_: $answer\n" : "Not verified: $_\n";
}
