]> git.donarmstrong.com Git - infobot.git/blobdiff - src/IRC/Irc.pl
fix more warnings
[infobot.git] / src / IRC / Irc.pl
index 8d09e0abad3799c39fb8985c8298ec6826c89ffe..36d57aae2ad52fe5a41f79e7c40c65d92577af65 100644 (file)
@@ -550,6 +550,8 @@ sub nick {
     if ($nick =~ /^$mask{nick}$/) {
        &DEBUG("nick: Changing nick to $nick (from $ident)");
        rawout("NICK ".$nick);
+       # unfortunately, on_nick doesn't catch ourself.
+       $ident  = $nick;
        return 1;
     }
     &DEBUG("nick: failed... why oh why (nick => $nick)");
@@ -579,11 +581,15 @@ sub joinNextChan {
            &status("joinNextChan: $i chans to join.");
        }
 
-       # chanserv check: channel specific.
-       ### what the hell is this for...
-       &chanServCheck($chan);
-
     } else {
+       if (exists $cache{joinTime}) {
+           my $delta   = time() - $cache{joinTime};
+           my $timestr = &Time2String($delta);
+           my $rate    = sprintf("%.1f", $delta / &getJoinChans() );
+           delete $cache{joinTime};
+
+           &DEBUG("time taken to join all chans: $timestr; rate: $rate sec/join");
+       }
        # chanserv check: global channels, in case we missed one.
 
        foreach ( &ChanConfList("chanServ_ops") ) {
@@ -687,10 +693,12 @@ sub clearIRCVars {
     undef %channels;
     undef %floodjoin;
 
-    @joinchan  = &getJoinChans();
+    @joinchan          = &getJoinChans(1);
+    $cache{joinTime}   = time();
 }
 
 sub getJoinChans {
+    my($show)  = @_;
     my @chans;
     my @skip;
 
@@ -714,12 +722,15 @@ sub getJoinChans {
        push(@chans, $_);
     }
 
+    my $str;
     if (scalar @skip) {
-       &status("gJC: channels not auto-joining: @skip");
+       $str = "gJC: channels not auto-joining: @skip";
     } else {
-       &status("gJC: auto-joining all chans.");
+       $str = "gJC: auto-joining all chans.";
     }
 
+    &status($str) if ($show);
+
     return @chans;
 }