#!/usr/bin/perl

open (TEXT, "/usr/bin/wget -q -O - 'http://opensource.atlassian.com/confluence/oss/display/GERONIMO/Unassigned2?decorator=printable' | /usr/bin/elinks -dump-width 120 -no-numbering -no-references 1 -dump 1 | ");



while (<TEXT>) {
    if (/-BEGIN-/){ 
	$begin=1; 
	$_="";
    }

    $count++ if /GERONIMO-[0-9]/;

    $_="" unless $begin; 
    
    if (/-END-/){ 
	while (<TEXT>) {}
	$_ = "";
    }

    
    if (/##$/) {
        s/ ##//; 
	chomp; 
	$foo=<TEXT>;
    };
    
    s/ *refresh ASF JIRA(.*)/$1\n\n$hr/;
    s/^  //;
    $content .= $_;
    $hr=$_ if /\* \*/; 
}
close TEXT;

$date=`date +%Y-%m-%d`;
print <<_TEXT_;
To: dev\@geronimo.apache.org
From: dblevins\@apache.org
Subject: Unassigned Issues ($count) as of $date

$content
_TEXT_
