]> git.donarmstrong.com Git - infobot.git/blobdiff - src/IRC/IrcHooks.pl
gmtime
[infobot.git] / src / IRC / IrcHooks.pl
index 117daa2d3f03ca0889b2d1e45be3d001f372727f..34456c63216d41bf720d19f6ef65cc75807c9786 100644 (file)
@@ -5,7 +5,7 @@
 #        NOTE: Based on code by Kevin Lenzo & Patrick Cole  (c) 1997
 #
 
-if (&IsParam("useStrict")) { use strict; }
+# use strict;  # TODO
 
 # GENERIC. TO COPY.
 sub on_generic {
@@ -133,6 +133,17 @@ sub on_chat {
     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) = @_;
 
@@ -192,8 +203,8 @@ sub on_endofmotd {
     # 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")) {
@@ -459,7 +470,7 @@ sub on_join {
     my $i              = scalar(keys %{ $channels{$chan} });
     my $j              = $cache{maxpeeps}{$chan} || 0;
 
-    if (time() > ($sched{shmFlush}{TIME} || time()) + 3600) {
+    if (!&IsParam("noSHM") && time() > ($sched{shmFlush}{TIME} || time()) + 3600) {
        &DEBUG("looks like schedulers died somewhere... restarting...");
        &setupSchedulers();
     }
@@ -571,8 +582,10 @@ sub on_join {
        }
     }
 
-    ### chanlimit check.
-#    &chanLimitVerify($chan);
+    ### botmail:
+    if (&IsChanConf("botmail")) {
+       &botmail::check(lc $who);
+    }
 
     ### wingate:
     &wingateCheck();
@@ -607,7 +620,8 @@ sub on_mode {
     my $nick   = $event->nick();
     $chan      = ($event->to)[0];
 
-    $args[0] =~ s/\s$//;
+    # last element is empty... so nuke it.
+    pop @args while ($args[$#args] eq "");
 
     if ($nick eq $chan) {      # UMODE
        &status(">>> mode $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob");
@@ -876,6 +890,7 @@ sub on_public {
            $v++;
 
            # don't allow ppl to cheat the stats :-)
+           next unless (defined $t);
            next unless ($time - $t > 10);
 
            my %hash = (
@@ -940,7 +955,7 @@ sub on_quit {
 
        $netsplit{lc $nick} = time();
        if (!exists $netsplitservers{$1}{$2}) {
-           &status("netsplit detected between $1 and $2 at [".scalar(localtime)."]");
+           &status("netsplit detected between $1 and $2 at [".scalar(gmtime)."]");
            $netsplitservers{$1}{$2} = time();
        }
     }
@@ -1043,7 +1058,7 @@ sub on_topicinfo {
 
     my $timestr;
     if (time() - $time > 60*60*24) {
-       $timestr        = "at ". localtime $time;
+       $timestr        = "at ". gmtime $time;
     } else {
        $timestr        = &Time2String(time() - $time) ." ago";
     }