#! /usr/bin/env perl use strict; use warnings; use IO::Socket; my $true = 1; sub exec_module { #enable formatting options my ( %colors , %format ); # Color Codes $colors{blue} = chr(3) . "02"; $colors{green} = chr(3) . "03"; $colors{red} = chr(3) . "04"; $colors{brown} = chr(3) . "05"; $colors{purple}= chr(3) . "06"; $colors{olive} = chr(3) . "07"; $colors{teal} = chr(3) . "10"; $colors{royal} = chr(3) . "12"; $colors{pink} = chr(3) . "13"; $colors{dgrey} = chr(3) . "14"; #formatting $format{bold} = chr(2); $format{underline} = chr(31); $format{italics} = chr(22); # Logging options: # If debug = 1, all messeges are shown # If debug = 0, only messeges sent with 2 flag are shown my $debug = 1; #logit ( $debug , 1 , "MODULE Generic: error messege" ); my $sock = shift; # io::sockets referenct to socket info in memory; my $channel = shift; # channel bot is opperating in my $client = shift; # connection string from IRC (ex: nick!~username@hostname (ident)) my $mailcheck = "/usr/bin/env perl /home/tool/imap-connect.pl|"; # Pointer to data array use like so: # $data->[0] = name of module called # $data->[1] = fields 1 and above are data after module call sepereated by spaces. # ie (!generic field1 field2) would be $data->[0] = generic, $data->[1] = field1 $data->[2] = field2 my $data = shift; while (1) { open (HANDLE, $mailcheck); while ( my $line = ) { if ( $line =~ /(no mail)/i ) { sleep(1); }else{ print $sock "PRIVMSG " . $channel . " :" . $format{bold} . $colors{red} . "[mail] " . $line . "\n"; } close ( HANDLE ); } sleep(20); } }