From: timriker Date: Mon, 28 Feb 2005 03:38:26 +0000 (+0000) Subject: postprocess for CLI X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=98b0dfaf8c6d3a4ed1365708503fdff85b806539;p=infobot.git postprocess for CLI git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1189 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/CLI/Support.pl b/src/CLI/Support.pl index 26a7416..c6fe276 100644 --- a/src/CLI/Support.pl +++ b/src/CLI/Support.pl @@ -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");