]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Modules/Wingate.pl
take a few more things literally
[infobot.git] / src / Modules / Wingate.pl
index 0bca79974617df614855240d8d78727bc2d5ba1b..da9deed0667cb7e1ea94ab69a3dd0ffd01dc111f 100644 (file)
@@ -12,7 +12,7 @@ use strict;
 my $select = IO::Select->new;
 
 sub Wingates {
-    my $file = "$main::infobot_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!