]> git.donarmstrong.com Git - infobot.git/commitdiff
join debugging
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Thu, 20 Oct 2011 17:17:11 +0000 (17:17 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Thu, 20 Oct 2011 17:17:11 +0000 (17:17 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@1904 c11ca15a-4712-0410-83d8-924469b57eb5

src/IRC/Irc.pl
src/IRC/Schedulers.pl
src/UserExtra.pl

index 21a31fe93bd097bdbe24e942bf5c36f39209941d..51b35a9ff17a6c0774d1542ca9af579a373ff082 100644 (file)
@@ -905,9 +905,9 @@ sub getJoinChans {
     # Display 'Chans:' only if more than $show seconds since last display
     if ( time() - $lastChansTime > $show ) {
         $lastChansTime = time();
-    }
-    else {
-        $show = 0;    # Don't display since < 15min since last
+    } else {
+       # Don't display since < 15min since last
+        $show = 0;
     }
 
     # can't join any if not connected
@@ -930,28 +930,25 @@ sub getJoinChans {
                 $chanconf{$_}{autojoin} = $val;
             }
             $skip++ if ( lc $val ne lc $nick );
-        }
-        else {
+        } else {
             $skip++;
         }
 
         if ($skip) {
             push( @skip, $_ );
-        }
-        else {
+        } else {
             if ( defined $channels{$_} or exists $channels{$_} ) {
                 push( @in, $_ );
-            }
-            else {
+            } else {
                 push( @join, $_ );
             }
         }
     }
 
     my $str;
-    $str .= ' in:' . join( ',',   sort @in )   if scalar @in;
-    $str .= ' skip:' . join( ',', sort @skip ) if scalar @skip;
     $str .= ' join:' . join( ',', sort @join ) if scalar @join;
+    $str .= ' in:' . join( ',',   sort @in )   if scalar @in;
+    $str .= ' skip:' . scalar @skip if scalar @skip;
 
     &status("Chans: ($nick)$str") if ($show);
 
index 3c7056f009b80d0738a55bb10025fb369240b5ac..5c95b679d1e1f527d5d568ed06711fc603eb5d5c 100644 (file)
@@ -713,22 +713,26 @@ sub ignoreCheck {
 }
 
 sub ircCheck {
+    my $retval = 0;
     if (@_) {
         &ScheduleThis( 300, 'ircCheck' );    # every 5 minutes
-        return if ( $_[0] eq '2' );          # defer.
+        return $retval if ( $_[0] eq '2' );          # defer.
     }
 
     $cache{statusSafe} = 1;
+    # save current connection
+    my $saveconn = $conn;
     foreach ( sort keys %conns ) {
         $conn = $conns{$_};
-       next if (!defined $conn);
-        my $mynick = $conn->nick();
+       next if (!defined $myconn);
+        my $nick = $myconn->nick();
         &DEBUG("ircCheck for $_");
         # Display with min of 900sec delay between redisplay
         # FIXME: should only use 900sec when we are on the LAST %conns
         my @join = &getJoinChans(900);
         if ( scalar @join ) {
-            &FIXME( 'ircCheck: found channels to join! ' . join( ',', @join ) );
+            &FIXME( 'ircCheck: found ' . scalar @join . 'channels to join! ' . join( ',', @join ) );
+            $retval += scalar @join;
             &joinNextChan();
         }
 
@@ -751,6 +755,8 @@ sub ircCheck {
             }
         }
     }
+    # restore connection we were called from
+    $conn = $saveconn;
 
     if ( grep /^\s*$/, keys %channels ) {
         &WARN('ircCheck: we have a NULL chan in hash channels? removing!');
@@ -776,17 +782,16 @@ sub ircCheck {
     $cache{statusSafe} = 0;
 
     ### USER FILE.
-    if ( $utime_userfile > $wtime_userfile and time() - $wtime_userfile > 3600 )
-    {
+    if ($utime_userfile > $wtime_userfile and time() - $wtime_userfile > 3600) {
         &writeUserFile();
         $wtime_userfile = time();
     }
     ### CHAN FILE.
-    if ( $utime_chanfile > $wtime_chanfile and time() - $wtime_chanfile > 3600 )
-    {
+    if ($utime_chanfile > $wtime_chanfile and time() - $wtime_chanfile > 3600) {
         &writeChanFile();
         $wtime_chanfile = time();
     }
+    return $retval;
 }
 
 sub miscCheck {
index 5215bb0942735bee10458069e6daf94cd87ff08b..fe28e79292f716016b641d6cf54e6ea0efd9100e 100644 (file)
@@ -21,7 +21,6 @@ sub chaninfo {
 
     if ( $chan eq '' ) {    # all channels.
         my $i = keys %channels;
-        my $reply = "I'm on \002$i\002 " . &fixPlural( 'channel', $i );
         my $tucount = 0;    # total user count.
         my $uucount = 0;    # unique user count.
         my %chans;
@@ -42,7 +41,6 @@ sub chaninfo {
         foreach $chan ( sort { $chans{$b} <=> $chans{$a} } keys %chans ) {
             push( @array, "$chan/" . $chans{$chan} );
         }
-        &performStrictReply( $reply . ': ' . join( ', ', @array ) );
 
         ### total user count.
         foreach $chan ( keys %channels ) {
@@ -60,14 +58,12 @@ sub chaninfo {
         $uucount = scalar( keys %nicks );
 
         my $chans = scalar( keys %channels );
-        &performStrictReply( "i've cached \002$tucount\002 "
-              . &fixPlural( 'user', $tucount )
-              . ", \002$uucount\002 unique "
-              . &fixPlural( 'user', $uucount )
-              . ", distributed over \002$chans\002 "
-              . &fixPlural( 'channel', $chans )
-              . '.' );
-        &ircCheck();
+        my $join = &ircCheck();
+        &performStrictReply(
+              "\002$chans/".($chans+$join)."\002 " . &fixPlural('channel', $chans)
+              . ", \002$tucount\002 " . &fixPlural('user', $tucount)
+              . ", \002$uucount\002 unique: "
+              . join(', ', @array));
 
         return;
     }