]> git.donarmstrong.com Git - infobot.git/blobdiff - src/Modules/Wingate.pl
* Rebranding from blootbot to infobot
[infobot.git] / src / Modules / Wingate.pl
index fee5c09fab2adec5d16883cdc484166a0de80961..1c3ab1ce470f95c29626c0afb5cb93cbf8cdb0fd 100644 (file)
@@ -1,6 +1,6 @@
 #
 #  Wingate.pl: Wingate checker.
-#      Author: xk <xk@leguin.openprojects.net>
+#      Author: dms
 #     Version: v0.3 (20000526).
 #     Created: 20000116
 #        NOTE: based on wingate.pl by fooz.
@@ -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 = "$::infobot_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!