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(FEDL, "$main::options{config}{datadir}/fed.list"); while() { 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(FEDL); } sub fedminus { my($self, $remotenick, $hostmask, $channel) = @_; open(FEDL, "$main::options{config}{datadir}/fed.list"); while() { 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(FEDL); } 1;