]> git.donarmstrong.com Git - infobot.git/blobdiff - src/IRC/IrcHooks.pl
minor update
[infobot.git] / src / IRC / IrcHooks.pl
index 085283d4bfda68ab3d0382ef0ad819c510b458ff..52d2c60e3dc988b6ae786159ed1b88a3256c42b5 100644 (file)
@@ -122,7 +122,6 @@ sub on_endofmotd {
        close IN;
     }
 
-    ### TODO: move this to end of &joinNextChan()?
     if ($firsttime) {
        &DEBUG("on_EOM: calling sS in 60s.");
        $conn->schedule(60, \&setupSchedulers, "");
@@ -130,7 +129,7 @@ sub on_endofmotd {
     }
 
     if (&IsParam("ircUMode")) {
-       &status("Changing user modes to $param{'ircUMode'}.");
+       &status("Attempting change of user modes to $param{'ircUMode'}.");
        &rawout("MODE $ident $param{'ircUMode'}");
     }
 
@@ -166,6 +165,9 @@ sub on_dcc_close {
     my $nick = $event->nick();
     my $sock = ($event->to)[0];
 
+    # DCC CHAT close on fork exit workaround.
+    return if ($bot_pid != $$);
+
     &DEBUG("dcc_close: nick => '$nick'.");
 
     if (exists $dcc{'SEND'}{$nick} and -f "temp/$nick.txt") {
@@ -212,7 +214,9 @@ sub on_disconnect {
     my $what = ($event->args)[0];
 
     &status("disconnect from $from ($what).");
-    $ircstats{'DisconnectReason'} = $what;
+    $ircstats{'DisconnectTime'}                = time();
+    $ircstats{'DisconnectReason'}      = $what;
+    $ircstats{'DisconnectCount'}++;
 
     # clear any variables on reconnection.
     $nickserv = 0;
@@ -263,12 +267,14 @@ sub on_endofnames {
 
        my @chans = split(/[\s\t]+/, $param{'chanServ_ops'});
 
+       ### TODO: since this function has a chan arg, why don't we use
+       ###       that instead of doing the following?
        foreach $chan (keys %channels) {
            next unless (grep /^$chan$/i, @chans);
 
            if (!exists $channels{$chan}{'o'}{$ident}) {
                &status("ChanServ ==> Requesting ops for $chan.");
-               rawout("PRIVMSG ChanServ :OP $chan $ident");
+               &rawout("PRIVMSG ChanServ :OP $chan $ident");
            }
        }
     }
@@ -636,7 +642,7 @@ sub on_targettoofast {
     }
 
 ###    .* wait (\d+) second/) {
-       &status($msg);
+       &status("X1 $msg");
        my $sleep = $3 + 10;
 
        &status("going to sleep for $sleep...");
@@ -894,6 +900,18 @@ sub hookMsg {
        &status("[$orig{who}] $orig{message}");
     }
 
+    if ((!$skipmessage or &IsParam("seenStoreAll")) and
+       &IsParam("seen") and
+       $msgType =~ /public/
+    ) {
+       $seencache{$who}{'time'} = time();
+       $seencache{$who}{'nick'} = $orig{who};
+       $seencache{$who}{'host'} = $uh;
+       $seencache{$who}{'chan'} = $talkchannel;
+       $seencache{$who}{'msg'}  = $orig{message};
+       $seencache{$who}{'msgcount'}++;
+    }
+
     return if ($skipmessage);
     return unless (&IsParam("minVolunteerLength") or $addressed);