my $resolve = inet_ntoa($packed);
&status(" resolved to $resolve.");
+ ### warning in Sys/Hostname line 78???
+ ### caused inside Net::IRC?
}
$irc = new Net::IRC;
sub joinfloodCheck {
my($who,$chan,$userhost) = @_;
- return unless (&IsParam("joinfloodCheck"));
+ return unless (&IsChanConf("joinfloodCheck"));
if (exists $netsplit{lc $who}) { # netsplit join.
&DEBUG("jfC: $who was in netsnipe; not checking.");
$ircstats{'ConnectTime'} = time();
$ircstats{'ConnectCount'}++;
- if (&IsParam("wingate")) {
+ if (&IsChanConf("wingate")) {
my $file = "$bot_base_dir/$param{'ircUser'}.wingate";
open(IN, $file);
while (<IN>) {
$who = $event->nick();
$chanstats{$chan}{'Join'}++;
- $userstats{lc $who}{'Join'} = time() if (&IsParam("seenStats"));
+ $userstats{lc $who}{'Join'} = time() if (&IsChanConf("seenStats"));
&joinfloodCheck($who, $chan, $event->userhost);
$chanstats{$chan}{'Part'}++;
&DeleteUserInfo($nick,$chan);
&clearChanVars($chan) if ($nick eq $ident);
- if (!&IsNickInAnyChan($nick) and &IsParam("seenStats")) {
+ if (!&IsNickInAnyChan($nick) and &IsChanConf("seenStats")) {
delete $userstats{lc $nick};
}
$msgtime = time();
$lastWho{$chan} = $nick;
### TODO: use $nick or lc $nick?
- if (&IsParam("seenStats")) {
+ if (&IsChanConf("seenStats")) {
$userstats{lc $nick}{'Count'}++;
$userstats{lc $nick}{'Time'} = time();
}
-# if (&IsParam("hehCounter")) {
+# if (&IsChanConf("hehCounter")) {
# #...
# }
} else {
&DEBUG("on_quit: nuh{lc $nick} does not exist! FIXME");
}
- delete $userstats{lc $nick} if (&IsParam("seenStats"));
+ delete $userstats{lc $nick} if (&IsChanConf("seenStats"));
# should fix chanstats inconsistencies bug #2.
if ($reason=~/^($mask{host})\s($mask{host})$/) { # netsplit.
&status(">>> $b_cyan$nick$ob has signed off IRC $b_red($ob$reason$b_red)$ob");
if ($nick =~ /^\Q$ident\E$/) {
- &DEBUG("!!! THIS SHOULD NEVER HAPPEN. FIXME HOPEFULLY");
+ &DEBUG("^^^ THIS SHOULD NEVER HAPPEN.");
}
+
if ($nick !~ /^\Q$ident\E$/ and $nick =~ /^\Q$param{'ircNick'}\E$/i) {
&status("own nickname became free; changing.");
&nick($param{'ircNick'});
# this may be fixed at a later date with topic queueing.
###
- $topic{$chan}{'Current'} = $topic if (1 and &IsParam("topic") == 1);
+ $topic{$chan}{'Current'} = $topic if (1 and &IsChanConf("topic") == 1);
$chanstats{$chan}{'Topic'}++;
&status(">>> topic/$b_blue$chan$ob by $b_cyan$nick$ob -> $topic");
} else { # join.
my ($nick, $chan, $topic) = $event->args;
- if (&IsParam("topic")) {
+ if (&IsChanConf("topic")) {
$topic{$chan}{'Current'} = $topic;
&topicAddHistory($chan,$topic);
}
&DEBUG("unknown msgType => $msgType.");
}
- if ((!$skipmessage or &IsParam("seenStoreAll")) and
- &IsParam("seen") and
+ if ((!$skipmessage or &IsChanConf("seenStoreAll")) and
+ &IsChanConf("seen") and
$msgType =~ /public/
) {
$seencache{$who}{'time'} = time();
}
if (defined $nuh) {
- if (defined $userHandle) {
- &DEBUG("line 1074: remove verifyUser");
+ if (!defined $userHandle) {
+ &DEBUG("line 1074: need verifyUser?");
+ &verifyUser($who, $nuh);
}
- $userHandle = &verifyUser($who, $nuh);
} else {
&DEBUG("hookMsg: 'nuh' not defined?");
}
}
my $time = time();
- my $interval = &getChanConfDefault("floodCycle","",60);
+ my $interval = &getChanConfDefault("floodCycle",60);
foreach $who (keys %flood) {
foreach (keys %{$flood{$who}}) {
&DEBUG("seenFlush: NO VALID FACTOID SUPPORT?");
}
+ if ($stats{'count_old'} ||= 1) {
+ &DEBUG("had to set count_old to 1.");
+ }
+
&status("Flushed $flushed seen entries.") if ($flushed);
&VERB(sprintf(" new seen: %03.01f%% (%d/%d)",
$stats{'new'}*100/$stats{'count_old'},
my $chan = $_;
foreach (keys %{ $ignore{$chan} }) {
- my @array = $ignore{$chan}{$_};
+ my @array = \@{ $ignore{$chan}{$_} };
foreach (@array) {
- &DEBUG(" => $_");
+ &DEBUG("ignore: => $_");
}
next;
if ($ident !~ /^\Q$param{ircNick}\E$/) {
&WARN("ircCheck: ident($ident) != param{ircNick}($param{IrcNick}).");
+ ### TODO: schedule check for own nick if taken?
}
&joinNextChan();
}
sub wingateCheck {
- return unless &IsParam("wingate");
- return unless ($param{'wingate'} =~ /^(.*\s+)?$chan(\s+.*)?$/i);
+ return unless &IsChanConf("wingate");
### FILE CACHE OF OFFENDING WINGATES.
foreach (grep /^$host$/, @wingateBad) {
&status("Wingate: RUNNING ON $host BY $who");
- &ban("*!*\@$host", "") if &IsParam("wingateBan");
+ &ban("*!*\@$host", "") if &IsChanConf("wingateBan");
+
+ my $reason = &getChanConf("wingateKick");
- next unless (&IsParam("wingateKick"));
- &kick($who, "", $param{'wingateKick'})
+ next unless ($reason);
+ &kick($who, "", $reason)
}
### RUN CACHE OF TRIED WINGATES.
}
sub getChanConfDefault {
- my($what, $chan, $default) = @_;
+ my($what, $default, $chan) = @_;
if (exists $param{$what}) {
&DEBUG("backward-compat: found param{$what} instead.");
sub rootWarn {
my ($nick,$user,$host,$chan) = @_;
my $attempt = &dbGet("rootwarn", "nick", lc($nick), "attempt") || 0;
+ my $warnmode = &getChanConf("rootWarnMode");
if ($attempt == 0) { # first timer.
- if (&IsParam("rootWarnMode") && $param{'rootWarnMode'} =~ /aggressive/i) {
+ if ($warnmode =~ /aggressive/i) {
&status(">>> Detected root user; notifying nick and channel.");
rawout("PRIVMSG $chan :R".("O" x int(rand 80 + 2))."T has landed!");
} else {
}
} else { # >3rd time occurrance.
- if (&IsParam("rootWarnMode")) {
- if ($param{'rootWarnMode'} =~ /aggressive/i) {
- if ($channels{$chan}{'o'}{$ident}) {
- &status("RootWarn: $nick... sigh... bye bye.");
- rawout("MODE $chan +b *!root\@$host"); # ban
- &kick($chan,$nick,"bye bye");
- }
+ if ($warnmode =~ /aggressive/i) {
+ if ($channels{$chan}{'o'}{$ident}) {
+ &status("RootWarn: $nick... sigh... bye bye.");
+ rawout("MODE $chan +b *!root\@$host"); # ban
+ &kick($chan,$nick,"bye bye");
}
}
}
if ($wingate) {
&::status("Wingate: RUNNING ON $host BY $::who.");
- if (&::IsParam("wingateBan")) {
+ if (&::IsChanConf("wingateBan") > 0) {
&::ban("*!*\@$host", "");
}
- if (&::IsParam("wingateKick")) {
- &::kick($::who, "", $::param{'wingateKick'});
+ my $reason = &::getChanConf("wingateKick");
+ if ($reason) {
+ &::kick($::who, "", $reason);
}
push(@::wingateBad, "$host\*");