]> git.donarmstrong.com Git - infobot.git/commitdiff
silly hack
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 25 Feb 2005 06:03:11 +0000 (06:03 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 25 Feb 2005 06:03:11 +0000 (06:03 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1180 c11ca15a-4712-0410-83d8-924469b57eb5

src/IRC/Irc.pl

index 8bfb09b48284815b895839dccc21aa85fab41260..e923d8f98b16d5f131e1716790a55280d4458af8 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);
@@ -23,6 +23,7 @@ use vars qw(@ircServers);
 #use open ':std';
 
 $nickserv      = 0;
+$postprocess;
 my $maxlinelen = 400;
 
 sub ircloop {
@@ -212,34 +213,45 @@ sub say {
        return;
     }
 
+    if ( $postprocess ) {
+       undef $postprocess;
+    } elsif ($postprocess = &getChanConf('postprocess', $talkchannel)) {
+       &DEBUG("say: $postprocess $msg");
+       &parseCmdHook("main", $postprocess . ' ' . $msg);
+       &parseCmdHook("extra", $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);
+       my $j = &getChanConfDefault("sendPublicLimitBytes", 1000);
+
+       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 {