diff options
| author | 2012-05-30 22:12:30 +0000 | |
|---|---|---|
| committer | 2012-05-30 22:12:30 +0000 | |
| commit | d7aa95f5ee6f1d03c707f5a1ecc87f6c3dee0b05 (patch) | |
| tree | bb87b71e6be9ada37e7d3c4e7a6e7f9e7e417b6d /modules | |
| parent | 14eb8a77479507875fe77640dd044d1a462e568a (diff) | |
make rules private, properly handle ghosting/releasing, added a proxy list, much faster join/startup
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/classes.pl | 14 | ||||
| -rw-r--r-- | modules/event.pl | 40 | ||||
| -rw-r--r-- | modules/inspect.pl | 4 | ||||
| -rw-r--r-- | modules/services.pl | 18 | ||||
| -rw-r--r-- | modules/xml.pl | 1 |
5 files changed, 65 insertions, 12 deletions
diff --git a/modules/classes.pl b/modules/classes.pl index d747815..fc80da1 100644 --- a/modules/classes.pl +++ b/modules/classes.pl @@ -25,6 +25,7 @@ sub new "gecos" => \&gecos, "nuhg" => \&nuhg, "levenflood" => \&levenflood, + "proxy" => \&proxy }; $self->{ftbl} = $tbl; bless($self); @@ -38,6 +39,17 @@ sub check return $self->{ftbl}->{$item}->(@_); } +sub proxy +{ + my ($chk, $id, $event, $chan, $rev) = @_; + if (defined($rev) and ($rev =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)\./)) { + if (defined($::proxies{"$4.$3.$2.$1"})) { + return 1; + } + } + return 0; +} + my %ls = (); sub levenflood { @@ -167,7 +179,7 @@ sub splitflood { process_cf(); } if ( scalar @{$cf{$id}{$chan}{$text}} == int($cut[0]) ) { - $bs{$id}{$text} = time; + $bs{$id}{$text} = time unless length($text) < 10; return 1; } return 0; diff --git a/modules/event.pl b/modules/event.pl index 39c733d..f9888e5 100644 --- a/modules/event.pl +++ b/modules/event.pl @@ -52,6 +52,7 @@ sub new $conn->add_handler('topic', \&irc_topic); $conn->add_handler('topicinfo', \&irc_topic); $conn->add_handler('nicknameinuse', \&on_errnickinuse); + $conn->add_handler('bannickchange', \&on_bannickchange); $conn->add_handler('kick', \&on_kick); $conn->add_handler('cping', \&on_ctcp); $conn->add_handler('cversion', \&on_ctcp); @@ -62,6 +63,8 @@ sub new $conn->add_handler('cclientinfo', \&on_ctcp); $conn->add_handler('cfinger', \&on_ctcp); $conn->add_handler('354', \&on_whoxreply); + $conn->add_handler('315', \&on_whoxover); + $conn->add_handler('263', \&on_whofuckedup); $conn->add_handler('account', \&on_account); $conn->add_handler('ping', \&on_ping); $conn->add_handler('banlist', \&on_banlist); @@ -128,7 +131,10 @@ sub on_account sub on_connect { my ($conn, $event) = @_; # need to check for no services $conn->sl('MODE AntiSpamMeta +Q'); - $conn->privmsg( 'NickServ', "ghost $::settings->{nick} $::settings->{pass}" ) if lc $event->{args}->[0] ne lc $::settings->{nick}; + if (lc $event->{args}->[0] ne lc $::settings->{nick}) { + $conn->privmsg( 'NickServ', "ghost $::settings->{nick} $::settings->{pass}" ); + $conn->privmsg( 'NickServ', "release $::settings->{nick} $::settings->{pass}" ); + } $conn->sl('CAP REQ :extended-join multi-prefix account-notify'); #god help you if you try to use this bot off freenode } @@ -141,7 +147,11 @@ sub on_join { if ( lc $conn->{_nick} eq lc $nick) { $::sc{$chan} = {}; mkdir($::settings->{log}->{dir} . $chan); - $conn->sl('who ' . $chan . ' %tcnuhra,314'); + $::synced{$chan} = 0; + unless ( @::syncqueue ) { + $conn->sl('who ' . $chan . ' %tcnuhra,314'); + } + push @::syncqueue, $chan; } $::sc{$chan}{users}{$nick} = {}; $::sc{$chan}{users}{$nick}{hostmask} = $event->{userhost}; @@ -232,6 +242,14 @@ sub on_errnickinuse $conn->nick($_); } +sub on_bannickchange +{ + my ($conn, $event) = @_; + $_ = ${$::settings->{altnicks}}[rand @{$::settings->{altnicks}}]; + print "Nick is in use, trying $_\n"; + $conn->nick($_); +} + sub on_quit { my ($conn, $event) = @_; @@ -455,6 +473,24 @@ sub on_whoxreply $::sn{$nick}->{account} = lc $account; } +sub on_whoxover +{ + my ($conn, $event) = @_; + my $chan = pop @::syncqueue; +# print Dumper($event); + $::synced{$event->{args}->[1]} = 1; + if (defined($chan) ){ + $conn->sl('who ' . $chan . ' %tcnuhra,314'); + } +} + +sub on_whofuckedup +{ + my ($conn, $event) = @_; + if ($::debugx{sync}) { + print "on_whofuckedup called!\n"; + } +} sub on_banlist { my ($conn, $event) = @_; diff --git a/modules/inspect.pl b/modules/inspect.pl index c3a9c1a..6a4afec 100644 --- a/modules/inspect.pl +++ b/modules/inspect.pl @@ -32,11 +32,11 @@ sub inspect { } } else { -# $iaddr = gethostbyname($event->{host}); + $iaddr = gethostbyname($event->{host}); $rev = join('.', reverse(unpack('C4', $iaddr))).'.' if (defined $iaddr); } ## NB: isn't there a better way to do this with grep, somehow? - %aonx = %{$::channels->{channel}->{master}->{event}}; + %aonx = %{$::rules->{event}}; foreach $chan ( @{$event->{to}} ) { next unless $chan =~ /^#/; next if ((defined($::channels->{channel}->{$chan}->{monitor})) and ($::channels->{channel}->{$chan}->{monitor} eq "no")); diff --git a/modules/services.pl b/modules/services.pl index e2c53e0..aafe68e 100644 --- a/modules/services.pl +++ b/modules/services.pl @@ -22,15 +22,19 @@ sub doServices { elsif ( $event->{args}->[0] =~ /^You are now identified/ ) { my @autojoins = @{$::settings->{autojoins}}; - while (@autojoins) { - my $joinstr = join (',', shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins); - $conn->schedule($i, sub { $conn->join($joinstr); }); - $i += 7; - } - $conn->schedule($i-6, sub { $conn->privmsg('#antispammeta', 'Now joined to all channels in '. (time - $::starttime) . " seconds."); }); +# while (@autojoins) { +# my $joinstr = join (',', shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins, +# shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins, shift @autojoins); +# $conn->schedule($i, sub { $conn->join($joinstr); }); +# $i += 1; +# } + $conn->join(join(',', @autojoins[0..30])); + $conn->join(join(',', @autojoins[30..60])); + $conn->schedule(2, sub { $conn->privmsg('#antispammeta', 'Now joined to all channels in '. (time - $::starttime) . " seconds."); }); } - elsif ($event->{args}->[0] =~ /has been killed$/ ) + elsif ($event->{args}->[0] =~ /has been (killed|released)/ ) { + print "Got kill/release successful from nickserv!\n" if $::debugx{services}; $conn->nick( $::settings->{nick} ); } elsif ($event->{args}->[0] =~ /Password Incorrect/ ) diff --git a/modules/xml.pl b/modules/xml.pl index dbe4365..14f5826 100644 --- a/modules/xml.pl +++ b/modules/xml.pl @@ -16,6 +16,7 @@ sub readXML { $::commands = $::xs1->XMLin( "$p/commands.xml", ForceArray => [qw/command/]); $::mysql = $::xs1->XMLin( "$p/mysql.xml", ForceArray => []); $::dnsbl = $::xs1->XMLin( "$p/dnsbl.xml", ForceArray => []); + $::rules = $::xs1->XMLin( "$p/rules.xml", ForceArray => []); } sub writeXML { |
