- move channel flags to sql table, include initial state
- move praise from blootbot.lang to "praise:<something>" in factoids?
- move lart from blootbot.lang to "lart:<something>" in factoids?
- - all IsChanConf tests MUST check for >0 as -1 is possible there are a
- lot of incorrect "if(IsChanConf("foo")) instances now
- debian BTS frontend "bugs"
- !country
- !dinstall
-#v1: blootbot -- blootbot -- written Sun Jan 1 22:59:37 2006
+#v1: blootbot -- InfoBot -- written Fri Jan 6 08:29:25 2006
#botpark
+ -OnJoin
+RootWarn
+autojoin
$chanconf{$chan}{$1} = 1;
} elsif (/^[\s\t]+\-(\S+)$/) { # bool, false.
- &DEBUG("deprecated support of negative options.") unless ($cache{negative});
# although this is supported in run-time configuration.
- $cache{negative} = 1;
-# $chanconf{$chan}{$1} = 0;
+ $chanconf{$chan}{$1} = 0;
} elsif (/^[\s\t]+(\S+)[\s\t]+(.*)$/) {# what = val.
$chanconf{$chan}{$1} = $2;
}
}
- delete $cache{negative};
-
&status("CHANFILE: Loaded: ".(scalar(keys %chanconf)-1)." chans");
}
# lets do it!
- if (&IsParam("factoidDeleteDelay") or &IsChanConf("factoidDeleteDelay")) {
+ if (&IsParam("factoidDeleteDelay") or &IsChanConf("factoidDeleteDelay") > 0) {
if (!($isop or $isau) and $faqtoid =~ / #DEL#$/) {
&msg($who, "cannot delete it ($faqtoid).");
return;
my $i = 0;
$i++ if (&IsParam("factoidDeleteDelay"));
- $i++ if (&IsChanConf("factoidDeleteDelay"));
+ $i++ if (&IsChanConf("factoidDeleteDelay") > 0);
if (!$i) {
&performReply("safe delete has been disable so what is there to undelete?");
return;
if (!$addressed) {
return '' unless ($finalQMark);
- return '' unless &IsChanConf("minVolunteerLength");
+ return '' unless &IsChanConf("minVolunteerLength") > 0;
return '' if (length $query < &::getChanConf('minVolunteerLength'));
} else {
### TODO: this should be caught in Process.pl?
$query =~ s/^\s+|\s+$//g; # bleh. hacked.
push(@query, $query) if ($query ne $x);
- if (&IsChanConf("factoidArguments")) {
+ if (&IsChanConf("factoidArguments") > 0) {
$result = &factoidArgs($query[0]);
return $result if (defined $result);
}
### TODO: Use &Forker(); move function to Debian.pl
- if (&IsChanConf('debianForFactoid')) {
+ if (&IsChanConf('debianForFactoid') > 0) {
&loadMyModule('Debian');
$result = &Debian::DebianFind($query); # ???
### TODO: debian module should tell, through shm, that it went
# factoid arguments handler.
# must start with a non-variable
- if (&IsChanConf("factoidArguments") and $lhs =~ /^[^\$]+.*\$/) {
+ if (&IsChanConf("factoidArguments") > 0 and $lhs =~ /^[^\$]+.*\$/) {
&status("Update: Factoid Arguments found.");
&status("Update: orig lhs => '$lhs'.");
&status("Update: orig rhs => '$rhs'.");
sub joinfloodCheck {
my($who,$chan,$userhost) = @_;
- return unless (&IsChanConf("joinfloodCheck"));
+ return unless (&IsChanConf("joinfloodCheck") > 0);
if (exists $netsplit{lc $who}) { # netsplit join.
&DEBUG("joinfloodCheck: $who was in netsplit; not checking.");
if ($msgType =~ /private/) {
# private messages.
$addressed = 1;
- if (&IsChanConf('addressCharacter')) {
+ if (&IsChanConf('addressCharacter') > 0) {
$addressCharacter = getChanConf('addressCharacter');
if ($message =~ s/^\Q$addressCharacter\E//) {
&msg($who, "The addressCharacter \"$addressCharacter\" is to get my attention in a normal channel. Please leave it off when messaging me directly.");
# public messages.
# addressing revamped by the xk.
### below needs to be fixed...
- if (&IsChanConf('addressCharacter')) {
+ if (&IsChanConf('addressCharacter') > 0) {
$addressCharacter = getChanConf('addressCharacter');
if ($message =~ s/^\Q$addressCharacter\E//) {
$addrchar = 1;
if ($addressed) {
my $time = $flood{$floodwho}{$message} || 0;
- if ($msgType eq "public" and (time() - $time < $interval)) {
+ if (!&hasFlag("o") and $msgType eq "public" and (time() - $time < $interval)) {
### public != personal who so the below is kind of pointless.
my @who;
foreach (keys %flood) {
}
$flood{$floodwho}{$message} = time();
- } elsif ($msgType eq "public" and &IsChanConf("kickOnRepeat")) {
+ } elsif ($msgType eq "public" and &IsChanConf("kickOnRepeat") > 0) {
# unaddressed, public only.
### TODO: use a separate "short-time" hash.
$seencache{$who}{'msg'} = $orig{message};
$seencache{$who}{'msgcount'}++;
}
- if (&IsChanConf("minVolunteerLength")) {
+ if (&IsChanConf("minVolunteerLength") > 0) {
# FIXME hack to treat unaddressed as if using addrchar
$addrchar = 1;
}
$chan = $c;
my $l = $channels{$chan}{'l'};
- return unless (&IsChanConf("chanlimitcheck"));
+ return unless (&IsChanConf("chanlimitcheck") > 0);
if (scalar keys %netsplit) {
&WARN("clV: netsplit active (1, chan = $chan); skipping.");
&DEBUG("chanServCheck: lowercased chan ($chan)");
}
- if (! &IsChanConf("chanServ_ops") ) {
+ if (! &IsChanConf("chanServ_ops") > 0) {
return 0;
}
}
# end of first time run.
- if (&IsChanConf('Wingate')) {
+ if (&IsChanConf('Wingate') > 0) {
my $file = "$bot_base_dir/$param{'ircUser'}.wingate";
open(IN, $file);
while (<IN>) {
### ROOTWARN:
&rootWarn($who,$user,$host,$chan) if (
- &IsChanConf('RootWarn') &&
+ &IsChanConf('RootWarn') > 0 &&
$user =~ /^~?r(oo|ew|00)t$/i
);
### emit a message based on who just joined
- &onjoin($who,$user,$host,$chan) if (&IsChanConf('OnJoin'));
+ &onjoin($who,$user,$host,$chan) if (&IsChanConf('OnJoin') > 0);
### NEWS:
- if (&IsChanConf('News') && &IsChanConf('newsKeepRead')) {
+ if (&IsChanConf('News') > 0 && &IsChanConf('newsKeepRead') > 0) {
if (!&loadMyModule('News')) { # just in case.
&DEBUG('could not load news.');
} else {
}
### botmail:
- if (&IsChanConf('botmail')) {
+ if (&IsChanConf('botmail') > 0) {
&botmail::check(lc $who);
}
# chanlimit code.
foreach $chan ( &getNickInChans($nick) ) {
- next unless ( &IsChanConf("chanlimitcheck") );
+ next unless ( &IsChanConf("chanlimitcheck") > 0);
next unless ( exists $channels{$_}{'l'} );
&DEBUG("on_quit: netsplit detected on $_; disabling chan limit.");
&status(">>> topic/$b_blue$chan$ob by $b_cyan$nick$ob -> $topic");
} else { # join.
my ($nick, $chan, $topic) = $event->args;
- if (&IsChanConf('Topic')) {
+ if (&IsChanConf('Topic') > 0) {
$topic{$chan}{'Current'} = $topic;
&topicAddHistory($chan,$topic);
}
}
sub wingateCheck {
- return unless &IsChanConf('Wingate');
+ return unless &IsChanConf('Wingate') > 0;
### FILE CACHE OF OFFENDING WINGATES.
foreach (grep /^$host$/, @wingateBad) {
&status("Wingate: RUNNING ON $host BY $who");
- &ban("*!*\@$host", "") if &IsChanConf('wingateBan');
+ &ban("*!*\@$host", "") if &IsChanConf('wingateBan') > 0;
my $reason = &getChanConf('wingateKick');
sub IsChanConfOrWarn {
my ($param) = @_;
- if (&IsChanConf($param)) {
+ if (&IsChanConf($param) > 0) {
return 1;
} else {
### TODO: specific reason why it failed.
my $state = ($1) ? 0 : 1;
# TODO: don't notify even if "News" is called.
- if (!&::IsChanConf("newsNotifyAll")) {
+ if (&::IsChanConf("newsNotifyAll") <= 0) {
&::DEBUG("news: chan => $chan, ::chan => $::chan.");
&::notice($who, "not available for this channel or disabled altogether.");
return;
return;
}
- if (&::IsChanConf("newsKeepRead")) {
+ if (&::IsChanConf("newsKeepRead") > 0) {
my $x = $::newsuser{$chan}{$who};
if (defined $x and ($x == 0 or $x == -1)) {
}
$::chan = $chan;
- my $x = &::IsChanConf("newsNotifyAll");
- return if (!$x);
+ return if (&::IsChanConf("newsNotifyAll") <= 0);
# I don't understand this code ;)
$t = 1 if (!defined $t);
# scalar @new, !$flag
my $unread = scalar @new;
my $total = scalar keys %{ $::news{$chan} };
- if (!$flag && !&::IsChanConf("newsTellUnread")) {
+ if (!$flag && &::IsChanConf("newsTellUnread") <= 0) {
return;
}
foreach (keys %chanconf) {
my $chan = $_;
-# &DEBUG("chan => $chan");
my @array = grep /^$param$/, keys %{ $chanconf{$chan} };
+ #&DEBUG("gCCL param => $param, chan => $chan, keys => " . join(':',keys %{ $chanconf{$chan} }) . " array => " . join(':', @array)) if ($param eq 'whatever');
next unless (scalar @array);
&WARN("multiple items found?");
}
- if ($array[0] eq "0") {
+ if ($chanconf{$chan}{$param} eq "0") {
$chan{$chan} = -1;
} else {
$chan{$chan} = 1;
# Return: 1 for enabled, 0 for passive disable, -1 for active disable.
sub IsChanConf {
my($param) = shift;
- my $debug = 0; # knocked tons of bugs with this! :)
+
+ # knocked tons of bugs with this! :)
+ my $debug = 0 # 1 if ($param eq "whatever");
if (!defined $param) {
&WARN("IsChanConf: param == NULL.");
return 1;
}
- $chan ||= "_default";
+ $chan ||= "_default";
my $old = $chan;
if ($chan =~ tr/A-Z/a-z/) {
}
### debug purposes only.
-# &DEBUG("param => $param, msgType => $msgType.");
-# foreach (keys %chan) {
-# &DEBUG(" $_ => $chan{$_}");
+# if ($debug) {
+# &DEBUG("param => $param, msgType => $msgType.");
+# foreach (keys %chan) {
+# &DEBUG(" $_ => $chan{$_}");
+# }
# }
if ($nomatch) {
} else {
&DEBUG("ICC: other: 0 ($param)") if ($debug);
}
-
return $chan{$chan} || $chan{_default} || 0;
- }
-
- if ($msgType eq "public") {
+ } elsif ($msgType =~ /^(public|private)$/i) {
if ($chan{$chan}) {
- &DEBUG("ICC: public: $chan{$chan} ($chan/$param)") if ($debug);
+ &DEBUG("ICC: $msgType: $chan{$chan} ($chan/$param)") if ($debug);
} elsif ($chan{_default}) {
- &DEBUG("ICC: public: $chan{_default} (_default/$param)") if ($debug);
- } else {
- &DEBUG("ICC: public: 0 ($param)") if ($debug);
- }
-
- return $chan{$chan} || $chan{_default} || 0;
- }
-
- if ($msgType eq "private") {
- if ($chan{_default}) {
- &DEBUG("ICC: private: $chan{_default} (_default/$param)") if ($debug);
- } elsif ($chan{$chan}) {
- &DEBUG("ICC: private: $chan{$chan} ($chan/$param) (hack)") if ($debug);
+ &DEBUG("ICC: $msgType: $chan{_default} (_default/$param)") if ($debug);
} else {
- &DEBUG("ICC: private: 0 ($param)") if ($debug);
+ &DEBUG("ICC: $msgType: 0 ($param)") if ($debug);
}
-
return $chan{$chan} || $chan{_default} || 0;
}
next;
}
- if (!&IsParam($_) and !&IsChanConf($_) and !&getChanConfList($_)) {
+ if (!&IsParam($_) and &IsChanConf($_) <= 0 and !&getChanConfList($_)) {
&DEBUG("loadMyModuleNow: $_ (2) not loaded.");
next;
}