X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FModules%2FWingate.pl;h=f834fb467e19248d109db2e54db50d97f62ac023;hb=b229ae39da80543887f9fd0ae46591070146d31f;hp=4a7a3637f167b23a55416d7512d27db3be825286;hpb=7ea50ad1d0e8dc5e851aa1c5db489de01e719d24;p=infobot.git diff --git a/src/Modules/Wingate.pl b/src/Modules/Wingate.pl index 4a7a363..f834fb4 100644 --- a/src/Modules/Wingate.pl +++ b/src/Modules/Wingate.pl @@ -12,7 +12,7 @@ use strict; my $select = IO::Select->new; sub Wingates { - my $file = "$main::blootbot_base_dir/$main::param{'ircUser'}.wingate"; + my $file = "$::blootbot_base_dir/$::param{'ircUser'}.wingate"; my @hosts; open(IN, $file); @@ -26,7 +26,7 @@ sub Wingates { foreach (@_) { next if (grep /^$_$/, @hosts); - &main::DEBUG("W: _ => '$_'."); + &::DEBUG("W: _ => '$_'."); &Wingate($_); } } @@ -42,7 +42,7 @@ sub Wingate { ); if (!defined $sock) { - &main::status("Wingate: connection refused to $host"); + &::status("Wingate: connection refused to $host"); return; } @@ -55,7 +55,7 @@ sub Wingate { my $buf; my $len = 0; if (!defined($len = sysread($luser, $buf, 512))) { - &main::status("Wingate: connection lost to $luser/$host."); + &::status("Wingate: connection lost to $luser/$host."); $select->remove($luser); close($luser); next; @@ -70,20 +70,21 @@ sub Wingate { $wingate++ if ($buf =~ /^Too many connected users - try again later$/); if ($wingate) { - &main::status("Wingate: RUNNING ON $host BY $main::who."); + &::status("Wingate: RUNNING ON $host BY $::who."); - if (&main::IsParam("wingateBan")) { - &main::ban("*!*\@$host", ""); + if (&::IsChanConf("wingateBan") > 0) { + &::ban("*!*\@$host", ""); } - if (&main::IsParam("wingateKick")) { - &main::kick($main::who, "", $main::param{'wingateKick'}); + my $reason = &::getChanConf("wingateKick"); + if ($reason) { + &::kick($::who, "", $reason); } - push(@main::wingateBad, "$host\*"); - &main::wingateWriteFile(); + push(@::wingateBad, "$host\*"); + &::wingateWriteFile(); } else { -### &main::DEBUG("no wingate."); +### &::DEBUG("no wingate."); } ### TODO: close telnet connection correctly!