X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FIRC%2FSchedulers.pl;h=5c95b679d1e1f527d5d568ed06711fc603eb5d5c;hb=d2f87ccd1d5f93afedc8f9f13b9f35260328614a;hp=d911030fa1ba590cd401083b9c11e398c5f2c2a9;hpb=a3b7cbdc04f29264990ff836bdd1e8c91cb9b337;p=infobot.git diff --git a/src/IRC/Schedulers.pl b/src/IRC/Schedulers.pl index d911030..5c95b67 100644 --- a/src/IRC/Schedulers.pl +++ b/src/IRC/Schedulers.pl @@ -713,21 +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{$_}; - 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(); } @@ -750,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!'); @@ -775,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 {