- IsChanConf now checks $param{} via &IsParam()
- removed debugging messages related to uptime. now we know why it
didn't run. (related to above comment)
- added 303/ison hook... although where are we notified of nicks
signing off?
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@608
c11ca15a-4712-0410-83d8-
924469b57eb5
$conn->add_global_handler('disconnect', \&on_disconnect);
$conn->add_global_handler([251,252,253,254,255], \&on_init);
### $conn->add_global_handler([251,252,253,254,255,302], \&on_init);
+ $conn->add_global_handler(303, \&on_ison); # notify.
$conn->add_global_handler(315, \&on_endofwho);
$conn->add_global_handler(422, \&on_endofwho); # nomotd.
$conn->add_global_handler(324, \&on_modeis);
return 'DCC CHAT MESSAGE';
}
+# is there isoff? how do we know if someone signs off?
+sub on_ison {
+ my ($self, $event) = @_;
+ my $x1 = ($event->args)[0];
+ my $x2 = ($event->args)[1];
+
+# &nick( $param{'ircNick'} );
+
+ &DEBUG("on_ison: x1 = '$x1', x2 => '$x2'");
+}
+
sub on_endofmotd {
my ($self) = @_;
# ok, we're free to do whatever we want now. go for it!
$running = 1;
- $conn->ison($ident);
- &DEBUG("adding self to NOTIFY/ISON.");
+ # add ourself to notify.
+ $conn->ison( $param{'ircNick'} );
# Q, as on quakenet.org.
if (&IsParam("Q_pass")) {
if ($ident !~ /^\Q$param{ircNick}\E$/) {
# this does not work unfortunately.
- &WARN("ircCheck: ident($ident) != param{ircNick}($param{IrcNick}).");
+ &WARN("ircCheck: ident($ident) != param{ircNick}($param{ircNick}).");
# this check is misleading... perhaps we should do a notify.
if (! &IsNickInAnyChan( $param{ircNick} ) ) {
# Created: 19990925.
#
-use strict;
+# use strict;
my $uptimerecords = 3;
my @results;
my $file = $file{utm};
- &::DEBUG("uGI: reading $file...");
-
if (!open(IN, $file)) {
&status("Writing uptime file for first time usage (nothing special).");
open(OUT,">$file");
}
close OUT;
+ &status("--- Saved uptime records.");
+
+ return unless defined $conn;
$conn->schedule(&getRandomInt("1800-3600"), \&uptimeWriteFile, "");
- return;
}
1;
next;
}
- # don't kill parent!
- if ($pid == $$) {
- &status("Fork: pid == \$\$ ($$)");
- next;
- }
+ if ($pid == $bot_pid) {
+ # don't kill parent, just warn.
+ &status("Fork: pid == \$bot_pid == \$\$ ($bot_pid)");
- if ( -d "/proc/$pid") {
+ } elsif ( -d "/proc/$pid") { # pid != bot_pid.
&status("Fork: killing $name ($pid)");
kill 9, $pid;
}
if ($count > 3) { # 3 seconds.
my $list = join(', ', keys %forked);
if (defined $who) {
- &msg($who, "already running ($list) => exceeded allowed forked processes count (1?).");
+ &msg($who, "exceeded allowed forked count: $list");
} else {
&status("Fork: I ran too many forked processes :) Giving up $name.");
}
+
return 0;
}
}
&writeUserFile();
&writeChanFile();
- if (&IsChanConf("uptime")) {
- &DEBUG("going to write uptime file info.");
- }
&uptimeWriteFile() if (&IsChanConf("uptime"));
&News::writeNews() if (&ChanConfList("news"));
&closeDB();
return 0;
}
+ # should we use IsParam() externally where needed or hack it in
+ # here just in case? fix it later.
+ if (&IsParam($param)) {
+ &status("ICC: found '$param' option in main config file.");
+ return 1;
+ }
+
$chan ||= "_default";
my $old = $chan;