]> git.donarmstrong.com Git - infobot.git/commitdiff
postprocess for CLI
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Mon, 28 Feb 2005 03:38:26 +0000 (03:38 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Mon, 28 Feb 2005 03:38:26 +0000 (03:38 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1189 c11ca15a-4712-0410-83d8-924469b57eb5

src/CLI/Support.pl

index 26a74167e518052b5ee1775dde5dde9e15391595..c6fe276d9ac207d41866d3f3bfbe3631f002b283 100644 (file)
@@ -4,6 +4,9 @@
 #        Version: v0.1 (20021028)
 #        Created: 20021028
 #
+use strict;
+
+my $postprocess;
 
 sub cliloop {
     &status("Using CLI...");
@@ -21,8 +24,8 @@ sub cliloop {
 
     # install libterm-readline-gnu-perl to get history support
     use Term::ReadLine;
-    $term = new Term::ReadLine 'blootbot';
-    $prompt = "$who> ";
+    my $term = new Term::ReadLine 'blootbot';
+    my $prompt = "$who> ";
     #$OUT = $term->OUT || STDOUT;
     while ( defined ($_ = $term->readline($prompt)) ) {
        $orig{message} = $_;
@@ -47,6 +50,16 @@ sub msg {
        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(">$nick< $msg");
 
     print("$nick: $msg\n");