From d7df5388d80ce68586473134c3f6fbd6de8bb701 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Wed, 27 Jul 2005 04:37:26 +0000 Subject: Detects double users from jamaica --- bot.pl | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/bot.pl b/bot.pl index 90f2047..3c68caf 100644 --- a/bot.pl +++ b/bot.pl @@ -7,8 +7,8 @@ use DBI; use POE; use POE::Component::IRC; -my $current_nick = 'francoise'; -my $channel = '#kiffer.de'; +my $current_nick = 'francoise_'; +my $channel = '#test'; POE::Component::IRC->new("francoise"); POE::Session->new ( _start => \&irc_start, @@ -40,6 +40,13 @@ my %commands = ( 'help' => \&francoise_help, 'alias' => \&francoise_alias, ); +# this helps identify jamaica autorejoiner and doublejoiner +# %jamaica holds encodedIP => nick +# %jamaicat holds encodedIP => lastjoin +# $jamaicatimeout says, after which timeout an IP is 'clear' +# for now 2 hours +my %jamaica; my %jamaicat; my $jamaicatimeout = 7200; + my $hv = join( '|', ( 'bin', 'bist', 'ist', 'is', 'sind', 'seid', 'werde', 'wirst', 'wird', 'werden', 'werdet', @@ -108,24 +115,35 @@ sub irc_nick { #user parted sub irc_part { - my $nick = (split /!/, $_[ARG0])[0]; my $channel = $_[ARG1]; - print "#-> $nick has parted $channel\n"; + if ( $_[ARG0] =~ /(.+)!~(.+)@(.+)/ ) { + my $nick = $1; my $user = $2; my $host = $3; + print "#-> $nick has parted $channel\n"; + } } #user joined sub irc_join { my ( $kernel, $channel ) = @_[KERNEL, ARG1]; - my $nick = (split /!/, $_[ARG0])[0]; - my $host = (split /@/, $_[ARG0])[1]; - if( $nick eq $current_nick ) { - $kernel->post( 'francoise', 'privmsg', $channel, 'Hier bin ich!'); - } else { - francoise_verifyuser( $nick, $host, 1 ); - } + if ( $_[ARG0] =~ /(.+)!~(.+)@(.+)/ ) { + my $nick = $1; my $user = $2; my $host = $3; + + if( $nick eq $current_nick ) { + $kernel->post( 'francoise', 'privmsg', $channel, 'Hier bin ich!'); + } else { + if( $host eq 'jamaica.kiffer.de' ) { + if( $jamaica{$user} && time() - $jamaicat{$user} < $jamaicatimeout ) { + $kernel->post( 'francoise', 'privmsg', $channel, "Ich glaub ja, $jamaica{$user} und $nick kennen sich." ) + } + $jamaica{$user} = $nick; $jamaicat{$user} = time(); + } - print "#-> $nick has joined $channel\n"; + francoise_verifyuser( $nick, $host, 1 ); + } + + print "#-> $nick has joined $channel\n"; + } } #user quit -- cgit v1.2.3