]> git.donarmstrong.com Git - infobot.git/blobdiff - src/IRC/Irc.pl
explicit $chan for getChanConfDefault
[infobot.git] / src / IRC / Irc.pl
index 8bfb09b48284815b895839dccc21aa85fab41260..0afd7d7690aafed8f93e3684173a3fe3049c63ff 100644 (file)
@@ -13,7 +13,7 @@ no strict 'subs'; # IN/STDIN
 use vars qw(%floodjoin %nuh %dcc %cache %conns %channels %param %mask
        %chanconf %orig %ircPort %ircstats %last %netsplit);
 use vars qw($irc $nickserv $conn $msgType $who $talkchannel
-       $addressed);
+       $addressed $postprocess);
 use vars qw($notcount $nottime $notsize $msgcount $msgtime $msgsize
                $pubcount $pubtime $pubsize);
 use vars qw($b_blue $ob);
@@ -212,34 +212,44 @@ sub say {
        return;
     }
 
+    if ( $postprocess ) {
+       undef $postprocess;
+    } elsif ($postprocess = &getChanConf('postprocess', $talkchannel)) {
+       &DEBUG("say: $postprocess $msg");
+       &parseCmdHook($postprocess . ' ' . $msg);
+       undef $postprocess;
+       return;
+    }
 
     &status("<$mynick/$talkchannel> $msg");
-    if (&whatInterface() =~ /IRC/) {
-       $msg    = "zero" if ($msg =~ /^0+$/);
-       my $t   = time();
-
-       if ($t == $pubtime) {
-           $pubcount++;
-           $pubsize += length $msg;
-
-           my $i = &getChanConfDefault("sendPublicLimitLines", 3);
-           my $j = &getChanConfDefault("sendPublicLimitBytes", 1000);
-
-           if ( ($pubcount % $i) == 0 and $pubcount) {
-               sleep 1;
-           } elsif ($pubsize > $j) {
-               sleep 1;
-               $pubsize -= $j;
-           }
 
-       } else {
-           $pubcount   = 0;
-           $pubtime    = $t;
-           $pubsize    = length $msg;
+    return unless (&whatInterface() =~ /IRC/);
+
+    $msg = "zero" if ($msg =~ /^0+$/);
+
+    my $t = time();
+
+    if ($t == $pubtime) {
+       $pubcount++;
+       $pubsize += length $msg;
+
+       my $i = &getChanConfDefault("sendPublicLimitLines", 3, $chan);
+       my $j = &getChanConfDefault("sendPublicLimitBytes", 1000, $chan);
+
+       if ( ($pubcount % $i) == 0 and $pubcount) {
+           sleep 1;
+       } elsif ($pubsize > $j) {
+           sleep 1;
+           $pubsize -= $j;
        }
 
-       $conn->privmsg($talkchannel, $msg);
+    } else {
+       $pubcount       = 0;
+       $pubtime        = $t;
+       $pubsize        = length $msg;
     }
+
+    $conn->privmsg($talkchannel, $msg);
 }
 
 sub msg {
@@ -264,8 +274,8 @@ sub msg {
        $msgcount++;
        $msgsize += length $msg;
 
-       my $i = &getChanConfDefault("sendPrivateLimitLines", 3);
-       my $j = &getChanConfDefault("sendPrivateLimitBytes", 1000);
+       my $i = &getChanConfDefault("sendPrivateLimitLines", 3, $chan);
+       my $j = &getChanConfDefault("sendPrivateLimitBytes", 1000, $chan);
        if ( ($msgcount % $i) == 0 and $msgcount) {
            sleep 1;
        } elsif ($msgsize > $j) {
@@ -316,8 +326,8 @@ sub notice {
        $notcount++;
        $notsize += length $txt;
 
-       my $i = &getChanConfDefault("sendNoticeLimitLines", 3);
-       my $j = &getChanConfDefault("sendNoticeLimitBytes", 1000);
+       my $i = &getChanConfDefault("sendNoticeLimitLines", 3, $chan);
+       my $j = &getChanConfDefault("sendNoticeLimitBytes", 1000, $chan);
 
        if ( ($notcount % $i) == 0 and $notcount) {
            sleep 1;