#!/usr/bin/perl -w
use Mail::POP3Client;
use Net::POP3;
use Net::SMTP;
use MIME::Entity;
use Flash;
use CGI;
my $q = new CGI;
print $q->header(-type=>'application/x-shockwave-flash');
my $pop = Net::POP3->new('127.1');
$pop->user('foo');
$pop->pass('baz');
my ($num, $size) = $pop->popstat();
my $lim = ($num<5)?$num:5;
my $framerate = $num*10;
my $width = 800;
my $height = 800;
openswf("-",$width,$height,$framerate);
# --- just to init colors
mul_colour(1,1,1,1);
add_colour(0,0,0,0);
my $soundid = nextid();
# --- let's start some sound right away
sound_rate(22000);
define_sound($soundid,"operation.wav");
sound_compression(4);
#start_sound($soundid);
ortho2(-100,100,-100,100);
my $blockid = nextid();
# --- define a font
define_font(nextid(),"Curl-Roman");
font_size(5);
font_slant(0);
my $backid = nextid();
define_text($backid,"< back >",1);
define_font(nextid(),"Haeberli");
font_size(5);
font_slant(0);
my ($subject, $from, $date);
if (defined ($q->param('number')))
{
my $id1 = nextid();
my $id2 = nextid();
my $id3 = nextid();
my $id4 = nextid();
my $id6 = nextid();
my $content = join "", @{$pop->get( $q->param('number'))};
my ($header,$body);
($header, $body) = split /\n\n/, $content, 2;
$body = "no message" unless (defined $body);
foreach(split /\n/, $header )
{
chomp;
/^From:\s+/i && ($from = $_);
/^Subject:\s+/i && ($subject = $_);
/^Date:\s+/i && ($date = $_);
}
define_text($id1,$from,0);
define_text($id2,substr($subject,0,20),0);
define_text($id3,$date,0);
start_button($id4,FlashTypePushButton);
push_matrix();
add_colour(1,0,0,0);
# scale(1.5,1.5,1.5);
add_buttonrecord(FlashBSHitTest|FlashBSDown|FlashBSUp,$backid,2000);
rotate(180,'y');
add_colour(0,0,1,0);
scale(1.2,1.2,1.2);
add_buttonrecord(FlashBSOver,$backid,2001);
pop_matrix();
add_colour(0,0,0,0);
on_condition(FlashOverUptoOverDown);
action_get_URL("/cgi-bin/swfgen/mail.cgi","");
end_button();
define_button_sound($id4, 0, 0, $soundid);
push_matrix;
add_colour(0,0,0,0);
translate(-50,100-10,0);
place_object($id4,$id4);
pop_matrix;
for (my $a=1; $a<10; $a++)
{
remove_object($id1);
# from
push_matrix;
add_colour(0,0,0,0);
translate(-100+$a,100-20,0);
place_object($id1,$id1);
pop_matrix;
remove_object($id2);
# subject
push_matrix;
add_colour(0,0,0,0);
translate(-100+$a,100-30,0);
place_object($id2,$id2);
pop_matrix;
remove_object($id3);
# date
push_matrix;
add_colour(0,0,0,0);
translate(-100+$a,100-40,0);
place_object($id3,$id3);
pop_matrix;
show_frame;
}
push_matrix;
add_colour(0.76,0.73,0.84,0.1);
rect($blockid,0,0,200,30,0);
pop_matrix;
for (my $ypos=100; $ypos>55; $ypos-=2)
{
remove_object($blockid);
push_matrix;
translate(-95,$ypos,0);
place_object($blockid,$blockid);
pop_matrix;
show_frame();
}
my @text = split(/\n/,$body);
for (my $b=0; $b<scalar(@text); $b++)
{
my $line = $text[$b];
#$line=~/[^a-zA-Z0-9 ]//g;
my $bodyid = nextid();
chomp($line);
#$text =~ s/\n//g;
define_text($bodyid,$line,0);
push_matrix;
add_colour(0,0,0,0);
translate(-50,100-50-($b*5),0);
place_object($bodyid,$bodyid);
pop_matrix;
show_frame;
}
}else{
for( $i = 1; $i <=$lim ; $i++ )
{
my $id1 = nextid();
my $id2 = nextid();
my $id3 = nextid();
foreach( @{$pop->get( $i )} )
{
chomp;
/^From:\s+/i && ($from = $');
/^Subject:\s+/i && ($subject = $');
/^Date:\s+/i && ($date = $');
}
define_text($id1,$from,0);
define_text($id2,substr($subject,0,20),0);
start_button($id3,FlashTypePushButton);
push_matrix();
add_colour(1,0,0,0);
# scale(1.5,1.5,1.5);
add_buttonrecord(FlashBSHitTest|FlashBSDown|FlashBSUp,$id2,2000);
#rotate(180,'x');
add_colour(0,0,1,0);
scale(1.2,1.2,1.2);
add_buttonrecord(FlashBSOver,$id2,2001);
pop_matrix();
add_colour(0,0,0,0);
on_condition(FlashOverUptoOverDown);
action_get_URL("/cgi-bin/swfgen/mail.cgi?number=$i","");
end_button();
for (my $a=1; $a<10; $a++)
{
remove_object($id1);
# from
push_matrix;
add_colour(0,0,0,0);
translate(-100+$a,100-(30*$i),0);
place_object($id1,$id1);
pop_matrix;
remove_object($id3);
# subject
push_matrix;
add_colour(0,0,0,0);
translate(-100+(2*$a),100-(30*$i)-10,0);
place_object($id3,$id3);
pop_matrix;
show_frame;
}
}
push_matrix;
add_colour(0.76,0.73,0.84,0.1);
rect($blockid,0,0,150,170,0);
translate(-200,-200,0);
pop_matrix;
for (my $scale=0; $scale<100; $scale+=4)
{
remove_object($blockid);
push_matrix;
translate(-100,-80,0);
scale($scale/100,$scale/100,$scale/100);
place_object($blockid,$blockid);
pop_matrix;
show_frame();
}
}
start_doaction();
action_stop();
end_doaction();
show_frame;
closeswf;
exit 0;
syntax highlighted by Code2HTML, v. 0.8.12