while (my $host = shift @ircServers) {
# JUST IN CASE. irq was complaining about this.
if ($lastrun == time()) {
- &DEBUG("hrm... lastrun == time()");
+ &DEBUG("ircloop: hrm... lastrun == time()");
$error++;
sleep 10;
next;
my ($msg) = @_;
if (!defined $msg) {
$msg ||= "NULL";
- &DEBUG("say: msg == $msg.");
+ &WARN("say: msg == $msg.");
return;
}
$pubcount++;
$pubsize += length $msg;
- if ($pubcount % 4 and $pubcount) {
+ if ( ($pubcount % 4) == 0 and $pubcount) {
sleep 1;
} elsif ($pubsize > 1500) {
sleep 1;
if (!defined $msg) {
$msg ||= "NULL";
- &DEBUG("msg: msg == $msg.");
+ &WARN("msg: msg == $msg.");
return;
}
$msgcount++;
$msgsize += length $msg;
- if ($msgcount % 4 and $msgcount) {
+ if ( ($msgcount % 4) == 0 and $msgcount) {
sleep 1;
} elsif ($msgsize > 1000) {
sleep 1;
sub action {
my ($target, $txt) = @_;
if (!defined $txt) {
- &DEBUG("action: txt == NULL.");
+ &WARN("action: txt == NULL.");
return;
}
sub notice {
my ($target, $txt) = @_;
if (!defined $txt) {
- &DEBUG("action: txt == NULL.");
+ &WARN("notice: txt == NULL.");
return;
}
$notcount++;
$notsize += length $txt;
- if ($notcount % 4 and $notcount) {
+ if ( ($notcount % 4) == 0 and $notcount) {
sleep 1;
} elsif ($notsize > 1500) {
sleep 1;
&status("join: already on $chan");
} else {
if (!$conn->join($chan)) {
- &DEBUG("join failed. trying connect!");
+ &DEBUG("joinchan: join failed. trying connect!");
$conn->connect();
}
}
return;
}
- &DEBUG("MODE $chan $modes");
+ &DEBUG("mode: MODE $chan $modes");
rawout("MODE $chan $modes");
}
my ($nick) = @_;
if ($nick =~ /^$mask{nick}$/) {
- &DEBUG("Changing nick to $nick (from $ident)");
+ &DEBUG("nick: Changing nick to $nick (from $ident)");
rawout("NICK ".$nick);
return 1;
}
- &DEBUG("nick failed... why oh why (nick => $nick)");
+ &DEBUG("nick: failed... why oh why (nick => $nick)");
return 0;
}
next unless ($chan{$chan} > 0);
if (!exists $channels{$chan}{'o'}{$ident}) {
- &status("ChanServ ==> Requesting ops for $chan.");
+ &status("ChanServ ==> Requesting ops for $chan. (1)");
&rawout("PRIVMSG ChanServ :OP $chan $ident");
}
}
} else {
foreach (keys %channels) {
next unless (/[A-Z]/);
- &DEBUG("hash channels contains mixed cased chan!!!");
+ &DEBUG("iNIC: hash channels contains mixed cased chan!!!");
}
return 0;
}
}
sub clearIRCVars {
- &DEBUG("clearIRCVars() called!");
+### &DEBUG("clearIRCVars() called!");
undef %channels;
undef %floodjoin;
}
sub closeDCC {
- &DEBUG("closeDCC called.");
+### &DEBUG("closeDCC called.");
foreach $type (keys %dcc) {
next if ($type ne uc($type));
my $c = $_;
my $count = scalar keys %{ $floodjoin{$c} };
next unless ($count > 5);
- &DEBUG("count => $count");
+ &DEBUG("joinflood: count => $count");
my $time;
foreach (keys %{ $floodjoin{$c} }) {
$time += $floodjoin{$c}{$_}{Time};
}
- &DEBUG("time => $time");
+ &DEBUG("joinflood: time => $time");
$time /= $count;
- &DEBUG("new time => $time");
+ &DEBUG("joinflood: new time => $time");
}
### Clean it up.
foreach ( &ChanConfList("chanServ_ops") ) {
next if (exists $channels{$chan}{'o'}{$ident});
- &status("ChanServ ==> Requesting ops for $chan.");
+ &status("ChanServ ==> Requesting ops for $chan. (3)");
&rawout("PRIVMSG ChanServ :OP $chan $ident");
}
# else check for chanserv.
if (grep /^\s*$/, keys %channels) {
- &WARN("we have a NULL chan in hash channels? removing!");
- delete $channels{''};
-
- &DEBUG("channels now:");
- foreach (keys %channels) {
- &status(" $_");
+ &WARN("ircCheck: we have a NULL chan in hash channels? removing!");
+ if (exists $channels{''}) {
+ &DEBUG("ircCheck: ok it existed!");
+ } else {
+ &DEBUG("ircCheck: this hsould never happen!");
}
- &DEBUG("channels END");
+ delete $channels{''};
}
&DEBUG("ircstats...");
}
# make backup of important files.
- &mkBackup( $bot_misc_dir."/blootbot.chan", 60*60*24*7);
- &mkBackup( $bot_misc_dir."/blootbot.users", 60*60*24*7);
- &mkBackup( $bot_base_dir."/blootbot-news.txt", 60*60*24*7);
+ &mkBackup( $bot_misc_dir."/blootbot.chan", 60*60*24*3);
+ &mkBackup( $bot_misc_dir."/blootbot.users", 60*60*24*3);
+ &mkBackup( $bot_base_dir."/blootbot-news.txt", 60*60*24*1);
# flush cache{lobotomy}
foreach (keys %{ $cache{lobotomy} }) {