Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/Perl/backup_irc/bot.pl

(Deskargatu)
#!/usr/bin/perl -w
#
#
use strict;
use IO::Socket::INET;
use Ircvar;



foreach(split(" ",$fichiers_a_charger))
{
print "$_\t";
do "$_" or die("[ERREUR]$_ $!");
print "[OK]\n";
}




while (1)
{
print "\n\n";
print "Tentative de connection: ";
my $sock = IO::Socket::INET->new(
	PeerAddr => "$server",
	PeerPort => $port,
	Proto => 'tcp' )
		or die("Connection echouee");
print "OK\n";
select $sock;
while (<$sock>)
{

	print STDOUT "$_";

	
SWITCH:
	{
		/^(?::[^\s]+ )?NOTICE AUTH :.* Checking Ident/i  && do { register_irc; last SWITCH;  };

		/^PING :(.*)/i && do { print "PONG $1"; print STDOUT "Sending:\tPONG\n"; last SWITCH; }; 
		/^:[^\s]+ 376/ && do { join_chan; last SWITCH; };

		/^:[^\s]+ 353 $bot_nick = $chan :(.*)\r/ && do { new_join($1); last SWITCH; };

		/:[^\s]+ (?:NICK|QUIT|PART|JOIN|KICK)/i && do { nickchange($_); last SWITCH;};

		/:[^\s]+ KICK $chan $bot_nick :/ && do { join_chan; last SWITCH;};
		
		
	
	    /:([^!]+)[^\s]+ PRIVMSG (?:$chan|[^\s]+) :(\@.*)\r/ && do { 
		foncts($chan,$fullpower,$1,$2); last SWITCH;};
	

      }
}
}
print "\n\n\nConnection close\n\n";