}
foreach (keys %{"hooks_$hashname"}) {
- # rename to something else!
+ # rename to something else! like $id or $label?
my $ident = $_;
+ if (!defined $cmd or !defined $ident) {
+ &WARN("cstubs: cmd or ident == NULL. ($cmd, $ident)");
+ next;
+ }
next unless ($cmd =~ /^$ident$/i);
if ($done) {
# modes w/ target affecting nick => cache it.
if ($mode =~ /[bov]/) {
if ($mode eq "o" and $nick eq "ChanServ" and $target =~ /^\Q$ident\E$/i) {
- &DEBUG("hookmode: chanserv deopped us! asking");
+ &VERB("hookmode: chanserv deopped us! asking",2);
&chanServCheck($chan);
}
if (exists $netsplit{lc $who}) {
delete $netsplit{lc $who};
$netsplit = 1;
+
if (!scalar keys %netsplit) {
&DEBUG("on_join: netsplit hash is now empty!");
undef %netsplitservers;
### on-join bans.
my @bans;
push(@bans, keys %{ $bans{$chan} }) if (exists $bans{$chan});
- push(@bans, keys %{ $bans{"*"} }) if (exists $bans{"*"});
+ push(@bans, keys %{ $bans{"*"} }) if (exists $bans{"*"});
+
foreach (@bans) {
my $ban = $_;
s/\?/./g;
}
### ROOTWARN:
+ # what's the +o requirement?
&rootWarn($who,$user,$host,$chan)
if (&IsChanConf("rootWarn") &&
$user =~ /^r(oo|ew|00)t$/i &&
sub on_modeis {
my ($self, $event) = @_;
- my $nick = $event->nick();
my ($myself, undef,@args) = $event->args();
+ my $nick = $event->nick();
$chan = ($event->args())[1];
&hookMode($nick, @args);
if ($check) {
&status("nickserv told us to register; doing it.");
+
if (&IsParam("nickServ_pass")) {
&status("NickServ: ==> Identifying.");
&rawout("PRIVMSG NickServ :IDENTIFY $param{'nickServ_pass'}");
}
} elsif ($nick =~ /^ChanServ$/i) { # chanserv.
&status("ChanServ: <== '$args'.");
+
} else {
if ($chan =~ /^$mask{chan}$/) { # channel notice.
&status("-$nick/$chan- $args");
$chanstats{$chan}{'Part'}++;
&delUserInfo($nick,$chan);
- &clearChanVars($chan) if ($nick eq $ident);
+ if ($nick eq $ident) {
+ &DEBUG("on_part: ok, I left $chan... clearChanVars...");
+ &clearChanVars($chan);
+ }
+
if (!&IsNickInAnyChan($nick) and &IsChanConf("seenStats")) {
delete $userstats{lc $nick};
}
if (exists $nuh{lc $nick}) {
delete $nuh{lc $nick};
} else {
- &DEBUG("on_quit: nuh{lc $nick} does not exist! FIXME");
+ # well.. it's good but weird that this has happened - lets just
+ # be quiet about it.
}
delete $userstats{lc $nick} if (&IsChanConf("seenStats"));
delete $chanstats{lc $nick};
$reason = "NETSPLIT: $1 <=> $2";
# chanlimit code.
- if (!scalar keys %netsplit) {
- my @l = &getNickInChans($nick);
- &DEBUG("on_quit: l => ".scalar(@l) );
+ my @l = &getNickInChans($nick);
+ &DEBUG("on_quit: l => ".scalar(@l) );
- foreach ( &getNickInChans($nick) ) {
- next unless ( &IsChanConf("chanlimitcheck") );
- next unless ( exists $channels{$_}{'l'} );
+ foreach $chan ( &getNickInChans($nick) ) {
+ next unless ( &IsChanConf("chanlimitcheck") );
+ next unless ( exists $channels{$_}{'l'} );
- &status("on_quit: netsplit detected on $_; disabling chan limit.");
- &rawout("MODE $_ -l");
- }
+ &DEBUG("on_quit: netsplit detected on $_; disabling chan limit.");
+ &rawout("MODE $_ -l");
}
$netsplit{lc $nick} = time();
return if ($_[0] eq "2"); # defer.
}
- if (&ChanConfList("news")) {
- } else {
+ if (!&ChanConfList("news")) {
&DEBUG("newsFlush: news disabled? (chan => $chan)");
return;
}
my $i = 0;
my $total = scalar(keys %{ $::news{$chan} });
- &DEBUG("newsFlush: chan => $chan (total => $total)");
+ if (!$total) {
+ delete $::news{$chan};
+ next;
+ }
foreach $item (keys %{ $::news{$chan} }) {
my $t = $::news{$chan}{$item}{Expire};
return if ($_[0] eq "2");
}
- $cache{chanlimitCheck}++;
- &DEBUG("clC: chanlimitCheck => $cache{chanlimitCheck}");
-
foreach $chan ( &ChanConfList("chanlimitcheck") ) {
next unless (&validChan($chan));
delete $netsplit{$_};
}
- &DEBUG("removed from netsplit list (".scalar(@delete)."): @delete") if (@delete);
+ if (@delete) {
+ my $str = scalar(@delete)."/".scalar(keys %netsplit);
+ &DEBUG("removed from netsplit list ($str): @delete");
+ }
&DEBUG("nsC: netsplitservers: ".scalar(keys %netsplitservers) );
&DEBUG("nsC: netsplit: ".scalar(keys %netsplit) );
}
my @list = &searchTable("factoids", "factoid_key", "factoid_key", " #DEL#");
- my $stale = &getChanConfDefault("factoidDeleteDelay", 30) *60*60*24;
+ my $stale = &getChanConfDefault("factoidDeleteDelay", 14) *60*60*24;
if ($stale < 1) {
# disable it since it's "illegal".
return;
}
- &DEBUG("stale => $stale");
my $time = time();
foreach (@list) {
my $age = &getFactInfo($_, "modified_time");
- &DEBUG("fC: _ => '$_'; age => $age");
if (!defined $age or $age !~ /^\d+$/) {
if (scalar @list > 50) {
next;
}
- &DEBUG("del factoid: delta => ".($time - $age) );
- &DEBUG("del factoid: stale => $stale");
next unless ($time - $age > $stale);
my $fix = $_;
my $agestr = &Time2String($time - $age);
&DEBUG("safedel: Removing '$_' for good. [$agestr old]");
- last;
-
&delFactoid($_);
}
}
&::pSReply( &::formListReply(0, $prefix, @list) );
} else { # !@list.
- &::DEBUG("deb: ok, !\@list, searching desc for '$query'.");
+ &::DEBUG("deb: ok, !\@list, searching desc for '$query'.") if ($debug);
my @list = &searchDesc($query);
if (!scalar @list) {
# Usage: &searchDesc($query);
sub searchDesc {
my ($dist, $query) = &getDistroFromStr($_[0]);
- &::DEBUG("deb: searchDesc: dist => '$dist', query => '$query'.");
+ &::DEBUG("deb: searchDesc: dist => '$dist', query => '$query'.") if ($debug);
$query =~ s/^\s+|\s+$//g;
# start of search.
$files .= " ".$_;
}
- &::DEBUG("deb(2): good = $good, bad = $bad...");
+ &::DEBUG("deb(2): good = $good, bad = $bad...") if ($debug);
if ($good == 0 and $bad != 0) {
my %urls = &fixDist($dist, %urlpackages);
my $stale = 0;
$stale++ if (&::isStale($pkgfile.".gz", $refresh));
$stale++ if (&::isStale($idxfile, $refresh));
- &::DEBUG("deb: gI: stale => '$stale'.");
+ &::DEBUG("deb: gI: stale => '$stale'.") if ($debug);
return 0 unless ($stale);
### STATIC URL.
foreach (@dists) {
my $dist = &getDistro($_); # incase the alias is returned, possible?
my $idx = "debian/Packages-$dist.idx";
- &::DEBUG("deb: gI: dist => $dist.");
- &::DEBUG("deb: gI: idx => $idx.");
- &::DEBUG("deb: gI: r => $refresh.");
# TODO: check if any of the Packages file have been updated then
# regenerate it, even if it's not stale.
}
$chan = $chans[0];
- &::DEBUG("Guessed $::who being on chan $chan",2);
+ &::VERB("Guessed $::who being on chan $chan",2);
$::chan = $chan; # hack for IsChanConf().
}
}
} else {
- &::DEBUG("news: could not parse '$what'");
&::notice($::who, "unknown command: $what");
}
}
Help => 'tell', Identifier => 'allowTelling',
Cmdstats => 'Tell') );
&addCmdHook("main", 'news', ('CODEREF' => 'News::Parse',
- Module => 'news', 'Cmdstats' => 'News' ) );
+ Module => 'news', 'Cmdstats' => 'News',
+ Identifier => 'news' ) );
&addCmdHook("main", 'countrystats', ('CODEREF' => 'countryStats',
# Forker => "NULL",
) );
if ($dns =~ /(\d+\.\d+\.\d+\.\d+)/) {
&status("DNS query by IP address: $in");
$match = $1;
+
$y = pack('C4', split(/\./, $match));
$x = (gethostbyaddr($y, &AF_INET));
} else {
$result = "I can't seem to find that address in DNS";
}
+
} else {
+
&status("DNS query by name: $in");
$x = join('.',unpack('C4',(gethostbyname($in))[4]));