summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <>2005-07-27 04:37:26 +0000
committererdgeist <>2005-07-27 04:37:26 +0000
commitd7df5388d80ce68586473134c3f6fbd6de8bb701 (patch)
tree8b5ce462e062a3dbf7fb04dad6229c8133a0cae6
parent1d8f586ba44d338321de8634e643c0a15ececbc8 (diff)
Detects double users from jamaica
-rw-r--r--bot.pl42
1 files 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;
7use POE; 7use POE;
8use POE::Component::IRC; 8use POE::Component::IRC;
9 9
10my $current_nick = 'francoise'; 10my $current_nick = 'francoise_';
11my $channel = '#kiffer.de'; 11my $channel = '#test';
12 12
13POE::Component::IRC->new("francoise"); 13POE::Component::IRC->new("francoise");
14POE::Session->new ( _start => \&irc_start, 14POE::Session->new ( _start => \&irc_start,
@@ -40,6 +40,13 @@ my %commands = ( 'help' => \&francoise_help,
40 'alias' => \&francoise_alias, 40 'alias' => \&francoise_alias,
41 ); 41 );
42 42
43# this helps identify jamaica autorejoiner and doublejoiner
44# %jamaica holds encodedIP => nick
45# %jamaicat holds encodedIP => lastjoin
46# $jamaicatimeout says, after which timeout an IP is 'clear'
47# for now 2 hours
48my %jamaica; my %jamaicat; my $jamaicatimeout = 7200;
49
43my $hv = join( '|', 50my $hv = join( '|',
44 ( 'bin', 'bist', 'ist', 'is', 'sind', 'seid', 51 ( 'bin', 'bist', 'ist', 'is', 'sind', 'seid',
45 'werde', 'wirst', 'wird', 'werden', 'werdet', 52 'werde', 'wirst', 'wird', 'werden', 'werdet',
@@ -108,24 +115,35 @@ sub irc_nick {
108 115
109#user parted 116#user parted
110sub irc_part { 117sub irc_part {
111 my $nick = (split /!/, $_[ARG0])[0];
112 my $channel = $_[ARG1]; 118 my $channel = $_[ARG1];
113 print "#-> $nick has parted $channel\n"; 119 if ( $_[ARG0] =~ /(.+)!~(.+)@(.+)/ ) {
120 my $nick = $1; my $user = $2; my $host = $3;
121 print "#-> $nick has parted $channel\n";
122 }
114} 123}
115 124
116#user joined 125#user joined
117sub irc_join { 126sub irc_join {
118 my ( $kernel, $channel ) = @_[KERNEL, ARG1]; 127 my ( $kernel, $channel ) = @_[KERNEL, ARG1];
119 my $nick = (split /!/, $_[ARG0])[0];
120 my $host = (split /@/, $_[ARG0])[1];
121 128
122 if( $nick eq $current_nick ) { 129 if ( $_[ARG0] =~ /(.+)!~(.+)@(.+)/ ) {
123 $kernel->post( 'francoise', 'privmsg', $channel, 'Hier bin ich!'); 130 my $nick = $1; my $user = $2; my $host = $3;
124 } else { 131
125 francoise_verifyuser( $nick, $host, 1 ); 132 if( $nick eq $current_nick ) {
126 } 133 $kernel->post( 'francoise', 'privmsg', $channel, 'Hier bin ich!');
134 } else {
135 if( $host eq 'jamaica.kiffer.de' ) {
136 if( $jamaica{$user} && time() - $jamaicat{$user} < $jamaicatimeout ) {
137 $kernel->post( 'francoise', 'privmsg', $channel, "Ich glaub ja, $jamaica{$user} und $nick kennen sich." )
138 }
139 $jamaica{$user} = $nick; $jamaicat{$user} = time();
140 }
127 141
128 print "#-> $nick has joined $channel\n"; 142 francoise_verifyuser( $nick, $host, 1 );
143 }
144
145 print "#-> $nick has joined $channel\n";
146 }
129} 147}
130 148
131#user quit 149#user quit