summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a7384ea)
- add gaps between if statement blocks.
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@650
c11ca15a-4712-0410-83d8-
924469b57eb5
use vars qw(@backlog);
use vars qw(%param %file %cache);
use vars qw(@backlog);
use vars qw(%param %file %cache);
$logtime = time();
$logcount = 0;
$logrepeat = 0;
$logtime = time();
$logcount = 0;
$logrepeat = 0;
my $status;
# a way to hook onto status without looping.
my $status;
# a way to hook onto status without looping.
- # todo: find why $channels{undef} is created.
+ # todo: find why $channels{} is created.
if (0 and $running and !$cache{statusSafe}) {
&ircCheck();
}
if ($input eq $logold) {
# allow perl flooding
if (0 and $running and !$cache{statusSafe}) {
&ircCheck();
}
if ($input eq $logold) {
# allow perl flooding
- $logrepeat++ unless ($input =~ /PERL: Use of uninitialized/);
+ if ($input !~ /PERL: Use of uninitialized/) {
+ $logrepeat++;
+ return;
+ }
+ } else {
+ $logold = $input;
- # todo: prevent massive repetitive throttling.
+ # if only I had followed how sysklogd does it, heh. lame me. -xk
+ &status("LOG: last message repeated $logrepeat times");
- &status("LOG: repeat throttle.");
- # we block it to ensure sequence of logging is intact.
- # could go with $conn->schedule but that's evil :)
- sleep 1;
- } else {
- $logold = $input;
}
# if it's not a scalar, attempt to warn and fix.
my $ref = ref $input;
if (defined $ref and $ref ne "") {
}
# if it's not a scalar, attempt to warn and fix.
my $ref = ref $input;
if (defined $ref and $ref ne "") {
- &status("status: 'input' is not scalar ($ref).");
+ &WARN("status: 'input' is not scalar ($ref).");
if ($ref eq "ARRAY") {
foreach (@$input) {
if ($ref eq "ARRAY") {
foreach (@$input) {
# does this work?
if ($input =~ /\n/) {
# does this work?
if ($input =~ /\n/) {
- foreach (split(/\n/, $input)) {
+ foreach (split /\n/, $input) {
my $time = time();
my $reset = 0;
my $time = time();
my $reset = 0;
+ # hrm... what is this supposed to achieve? nothing I guess.
if ($logtime == $time) {
if ($logcount < 25) { # too high?
$logcount++;
} else {
sleep 1;
if ($logtime == $time) {
if ($logcount < 25) { # too high?
$logcount++;
} else {
sleep 1;
- &status("LOG: Throttling."); # recursive?
+ &status("LOG: Throttling.");
$reset++;
}
} else { # $logtime != $time.
$reset++;
}
} else { # $logtime != $time.
} elsif ($printable =~ s/^\* (\S+)\/(\S+) //) {
# public action.
print "$b_white*$ob $b_cyan$1$ob/$b_blue$2$ob $printable\n";
} elsif ($printable =~ s/^\* (\S+)\/(\S+) //) {
# public action.
print "$b_white*$ob $b_cyan$1$ob/$b_blue$2$ob $printable\n";
} elsif ($printable =~ s/^(-\S+-) //) {
# notice
print "$_green$1 $printable$ob\n";
} elsif ($printable =~ s/^(-\S+-) //) {
# notice
print "$_green$1 $printable$ob\n";
} elsif ($printable =~ s/^(\* )?(\[\S+\]) //) {
# message/private action from someone
print "$b_white$1$ob" if (defined $1);
print "$b_red$2 $printable$ob\n";
} elsif ($printable =~ s/^(\* )?(\[\S+\]) //) {
# message/private action from someone
print "$b_white$1$ob" if (defined $1);
print "$b_red$2 $printable$ob\n";
} elsif ($printable =~ s/^(>\S+<) //) {
# i'm messaging someone
print "$b_magenta$1 $printable$ob\n";
} elsif ($printable =~ s/^(>\S+<) //) {
# i'm messaging someone
print "$b_magenta$1 $printable$ob\n";
} elsif ($printable =~ s/^(enter:|update:|forget:) //) {
# something that should be SEEN
print "$b_green$1 $printable$ob\n";
} elsif ($printable =~ s/^(enter:|update:|forget:) //) {
# something that should be SEEN
print "$b_green$1 $printable$ob\n";
} else {
print "$printable\n";
}
} else {
print "$printable\n";
}
} else {
#print "VERBOSITY IS OFF?\n";
}
} else {
#print "VERBOSITY IS OFF?\n";
}
return unless (&IsParam("logfile"));
return unless (defined fileno LOG);
return unless (&IsParam("logfile"));
return unless (defined fileno LOG);
- # remove control characters from logging.
+ # remove control characters from logging to LOGFILE.
for ($input) {
s/\e\[[0-9;]+m//g; # escape codes.
s/[\cA-\c_]//g; # control chars.
for ($input) {
s/\e\[[0-9;]+m//g; # escape codes.
s/[\cA-\c_]//g; # control chars.