rendered paste bodypackage 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)!");
}
$fed = undef;
}
close(FEDLM);
}
1;