All pastes #236729 Raw Edit

crashes

public text v1 · immutable
·published 2006-11-04 00:24 UTC
rendered paste body
package Modules::fedcount;

sub new {
   main::add_handler('event join', 'fedplus');
   main::add_handler('event part', 'fedminus');
   my $self = {};
   bless $self;
   return $self;
}

sub del {
   main::del_handler('event join', 'fedplus');
   main::del_handler('event part', 'fedminus');
}

sub fedplus {
  my($self, $remotenick, $hostmask, $channel) = @_;
  open(FEDLP, "$main::options{config}{datadir}/fed.list");
  while(<FEDLP>) {
    chop;
    my $fed = quotemeta $_;
    if($remotenick !~ /$fed/i) {
      next;
    }else{
      main::irc_sayfh($channel, "!(ALERT)! THE FED COUNT OF $channel HAS INCREASED BY [1] !(ALERT)!");
    }
  }
  close(FEDLP);  
  $fed = undef;
}

sub fedminus {
  my($self, $remotenick, $hostmask, $channel) = @_;
  open(FEDLM, "$main::options{config}{datadir}/fed.list");
  while(<FEDLM>) {
    chop;
    my $fed = quotemeta $_;
    if($remotenick !~ /$fed/i) {
      next;
    }else{
      main::irc_sayfh($channel, "!(ALERT)! THE FED COUNT OF $channel HAS DECREASED BY [1] !(ALERT)!");
    }
  }
  close(FEDLM);
  $fed = undef;
}

1;