]> git.donarmstrong.com Git - infobot.git/commitdiff
fixed seen ""
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 18 Apr 2001 15:07:14 +0000 (15:07 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Wed, 18 Apr 2001 15:07:14 +0000 (15:07 +0000)
added where debugging messages came from (functions)
fixed reversed use of % in if statement, stupid me :)
changed backup times for files again

git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@451 c11ca15a-4712-0410-83d8-924469b57eb5

src/CommandStubs.pl
src/IRC/Irc.pl
src/IRC/IrcHooks.pl
src/IRC/Schedulers.pl

index a2223aebc39924800e444d07850aac5158eec1d4..3b732d63cf2508a3b82375fe8a1bc56ec5625b27 100644 (file)
@@ -462,7 +462,7 @@ sub uptime {
 sub seen {
     my($person) = @_;
 
-    if (!defined $person) {
+    if (!defined $person or $person =~ /^$/) {
        &help("seen");
 
        my $i = &countKeys("seen");
index 32e5158c6b79630f1f5588c0391396802d33ced1..9334f98ecdef5e385a4f41c658c1d4c6861e5baf 100644 (file)
@@ -27,7 +27,7 @@ loop:;
     while (my $host = shift @ircServers) {
        # JUST IN CASE. irq was complaining about this.
        if ($lastrun == time()) {
-           &DEBUG("hrm... lastrun == time()");
+           &DEBUG("ircloop: hrm... lastrun == time()");
            $error++;
            sleep 10;
            next;
@@ -173,7 +173,7 @@ sub say {
     my ($msg) = @_;
     if (!defined $msg) {
        $msg ||= "NULL";
-       &DEBUG("say: msg == $msg.");
+       &WARN("say: msg == $msg.");
        return;
     }
 
@@ -186,7 +186,7 @@ sub say {
            $pubcount++;
            $pubsize += length $msg;
 
-           if ($pubcount % 4 and $pubcount) {
+           if ( ($pubcount % 4) == 0 and $pubcount) {
                sleep 1;
            } elsif ($pubsize > 1500) {
                sleep 1;
@@ -212,7 +212,7 @@ sub msg {
 
     if (!defined $msg) {
        $msg ||= "NULL";
-       &DEBUG("msg: msg == $msg.");
+       &WARN("msg: msg == $msg.");
        return;
     }
 
@@ -225,7 +225,7 @@ sub msg {
            $msgcount++;
            $msgsize += length $msg;
 
-           if ($msgcount % 4 and $msgcount) {
+           if ( ($msgcount % 4) == 0 and $msgcount) {
                sleep 1;
            } elsif ($msgsize > 1000) {
                sleep 1;
@@ -246,7 +246,7 @@ sub msg {
 sub action {
     my ($target, $txt) = @_;
     if (!defined $txt) {
-       &DEBUG("action: txt == NULL.");
+       &WARN("action: txt == NULL.");
        return;
     }
 
@@ -266,7 +266,7 @@ sub action {
 sub notice {
     my ($target, $txt) = @_;
     if (!defined $txt) {
-       &DEBUG("action: txt == NULL.");
+       &WARN("notice: txt == NULL.");
        return;
     }
 
@@ -278,7 +278,7 @@ sub notice {
        $notcount++;
        $notsize += length $txt;
 
-       if ($notcount % 4 and $notcount) {
+       if ( ($notcount % 4) == 0 and $notcount) {
            sleep 1;
        } elsif ($notsize > 1500) {
            sleep 1;
@@ -405,7 +405,7 @@ sub joinchan {
        &status("join: already on $chan");
     } else {
        if (!$conn->join($chan)) {
-           &DEBUG("join failed. trying connect!");
+           &DEBUG("joinchan: join failed. trying connect!");
            $conn->connect();
        }
     }
@@ -438,7 +438,7 @@ sub mode {
        return;
     }
 
-    &DEBUG("MODE $chan $modes");
+    &DEBUG("mode: MODE $chan $modes");
 
     rawout("MODE $chan $modes");
 }
@@ -543,11 +543,11 @@ sub nick {
     my ($nick) = @_;
 
     if ($nick =~ /^$mask{nick}$/) {
-       &DEBUG("Changing nick to $nick (from $ident)");
+       &DEBUG("nick: Changing nick to $nick (from $ident)");
        rawout("NICK ".$nick);
        return 1;
     }
-    &DEBUG("nick failed... why oh why (nick => $nick)");
+    &DEBUG("nick: failed... why oh why (nick => $nick)");
 
     return 0;
 }
@@ -584,7 +584,7 @@ sub joinNextChan {
        next unless ($chan{$chan} > 0);
            
        if (!exists $channels{$chan}{'o'}{$ident}) {
-           &status("ChanServ ==> Requesting ops for $chan.");
+           &status("ChanServ ==> Requesting ops for $chan. (1)");
            &rawout("PRIVMSG ChanServ :OP $chan $ident");
        }
     }
@@ -626,7 +626,7 @@ sub IsNickInChan {
     } else {
        foreach (keys %channels) {
            next unless (/[A-Z]/);
-           &DEBUG("hash channels contains mixed cased chan!!!");
+           &DEBUG("iNIC: hash channels contains mixed cased chan!!!");
        }
        return 0;
     }
@@ -681,7 +681,7 @@ sub clearChanVars {
 }
 
 sub clearIRCVars {
-    &DEBUG("clearIRCVars() called!");
+###    &DEBUG("clearIRCVars() called!");
     undef %channels;
     undef %floodjoin;
 
@@ -722,7 +722,7 @@ sub getJoinChans {
 }
 
 sub closeDCC {
-    &DEBUG("closeDCC called.");
+###    &DEBUG("closeDCC called.");
 
     foreach $type (keys %dcc) {
        next if ($type ne uc($type));
@@ -761,16 +761,16 @@ sub joinfloodCheck {
        my $c = $_;
        my $count = scalar keys %{ $floodjoin{$c} };
        next unless ($count > 5);
-       &DEBUG("count => $count");
+       &DEBUG("joinflood: count => $count");
 
        my $time;
        foreach (keys %{ $floodjoin{$c} }) {
            $time += $floodjoin{$c}{$_}{Time};
        }
-       &DEBUG("time => $time");
+       &DEBUG("joinflood: time => $time");
        $time /= $count;
 
-       &DEBUG("new time => $time");
+       &DEBUG("joinflood: new time => $time");
     }
 
     ### Clean it up.
index db2365376c836c49b6e8920976976cf7f73dc3aa..d2bd05ad43a81000497cfb4b3dcbe3cbbf987aec 100644 (file)
@@ -368,7 +368,7 @@ sub on_endofnames {
     return unless ($nickserv);
 
     if (!exists $channels{$chan}{'o'}{$ident}) {
-       &status("ChanServ ==> Requesting ops for $chan.");
+       &status("ChanServ ==> Requesting ops for $chan. (2)");
        &rawout("PRIVMSG ChanServ :OP $chan $ident");
     }
 }
index 1587d0b63d5c1d3826c75e4426c2d91747d0e920..9ad8d8af555b866f7f48c5a3424ea6e85734b58d 100644 (file)
@@ -658,7 +658,7 @@ sub ircCheck {
     foreach ( &ChanConfList("chanServ_ops") ) {
        next if (exists $channels{$chan}{'o'}{$ident});
 
-       &status("ChanServ ==> Requesting ops for $chan.");
+       &status("ChanServ ==> Requesting ops for $chan. (3)");
        &rawout("PRIVMSG ChanServ :OP $chan $ident");
     }
 
@@ -693,15 +693,14 @@ sub ircCheck {
        # else check for chanserv.
 
     if (grep /^\s*$/, keys %channels) {
-       &WARN("we have a NULL chan in hash channels? removing!");
-       delete $channels{''};
-
-       &DEBUG("channels now:");
-       foreach (keys %channels) {
-           &status("  $_");
+       &WARN("ircCheck: we have a NULL chan in hash channels? removing!");
+       if (exists $channels{''}) {
+           &DEBUG("ircCheck: ok it existed!");
+       } else {
+           &DEBUG("ircCheck: this hsould never happen!");
        }
 
-       &DEBUG("channels END");
+       delete $channels{''};
     }
 
     &DEBUG("ircstats...");
@@ -762,9 +761,9 @@ sub miscCheck {
     }
 
     # make backup of important files.
-    &mkBackup( $bot_misc_dir."/blootbot.chan", 60*60*24*7);
-    &mkBackup( $bot_misc_dir."/blootbot.users", 60*60*24*7);
-    &mkBackup( $bot_base_dir."/blootbot-news.txt", 60*60*24*7);
+    &mkBackup( $bot_misc_dir."/blootbot.chan", 60*60*24*3);
+    &mkBackup( $bot_misc_dir."/blootbot.users", 60*60*24*3);
+    &mkBackup( $bot_base_dir."/blootbot-news.txt", 60*60*24*1);
 
     # flush cache{lobotomy}
     foreach (keys %{ $cache{lobotomy} }) {