From: timriker Date: Thu, 4 Sep 2003 17:14:01 +0000 (+0000) Subject: move cliloop to CLI ;-) X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0fabc2bb43651b34aa80263c92eafa188bd470e4;p=infobot.git move cliloop to CLI ;-) git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@824 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/blootbot/src/CLI/Support.pl b/blootbot/src/CLI/Support.pl index 42df6df..6b2de5b 100644 --- a/blootbot/src/CLI/Support.pl +++ b/blootbot/src/CLI/Support.pl @@ -5,6 +5,34 @@ # Created: 20021028 # +sub cliloop { + &status("Using CLI..."); + &status("Now type what you want."); + + $nuh = "local!local\@local"; + $uh = "local\@local"; + $who = "local"; + $orig{who} = "local"; + $ident = $param{'ircNick'}; + $chan = $talkchannel = "_local"; + $addressed = 1; + $msgType = 'public'; + + # install libterm-readline-gnu-perl to get history support + use Term::ReadLine; + $term = new Term::ReadLine 'blootbot'; + $prompt = "$who> "; + #$OUT = $term->OUT || STDOUT; + while ( defined ($_ = $term->readline($prompt)) ) { + $orig{message} = $_; + $message = $_; + chomp $message; + last if ($message =~ m/^quit$/); + $_ = &process() if $message; + } + &doExit(); +} + sub msg { my ($nick, $msg) = @_; if (!defined $nick) { diff --git a/blootbot/src/interface.pl b/blootbot/src/interface.pl index c786b83..1a22599 100644 --- a/blootbot/src/interface.pl +++ b/blootbot/src/interface.pl @@ -13,32 +13,4 @@ sub whatInterface { } } -sub cliloop { - &status("Using CLI..."); - &status("Now type what you want."); - - $nuh = "local!local\@local"; - $uh = "local\@local"; - $who = "local"; - $orig{who} = "local"; - $ident = $param{'ircNick'}; - $chan = $talkchannel = "_local"; - $addressed = 1; - $msgType = 'public'; - - # install libterm-readline-gnu-perl to get history support - use Term::ReadLine; - $term = new Term::ReadLine 'blootbot'; - $prompt = "$who> "; - #$OUT = $term->OUT || STDOUT; - while ( defined ($_ = $term->readline($prompt)) ) { - $orig{message} = $_; - $message = $_; - chomp $message; - last if ($message =~ m/^quit$/); - $_ = &process() if $message; - } - &doExit(); -} - 1;