]> git.donarmstrong.com Git - infobot.git/blobdiff - src/interface.pl
foo+1 does not work on sqlReplace for sqlite.
[infobot.git] / src / interface.pl
index 70331a79e88d437e8185b3a4c2eb327efe8c55b1..c786b8379ac2c41dd5a708d9ca06fa883803c102 100644 (file)
@@ -1,10 +1,9 @@
 #
 # interface.pl:
-#
 #       Author:
 #
 
-#use strict;
+# use strict;  # TODO
 
 sub whatInterface {
     if (!&IsParam("Interface") or $param{'Interface'} =~ /IRC/) {
@@ -23,15 +22,23 @@ sub cliloop {
     $who = "local";
     $orig{who} = "local";
     $ident = $param{'ircNick'};
-    $talkchannel = "#CLI";
+    $chan = $talkchannel = "_local";
     $addressed = 1;
+    $msgType = 'public';
 
-    print ">>> ";
-    while (<STDIN>) {
+    # 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} = $_;
-       $_ = &process("local", 'public', $_);
-       print ">>> ";
+       $message = $_;
+       chomp $message;
+       last if ($message =~ m/^quit$/);
+       $_ = &process() if $message;
     }
+    &doExit();
 }
 
 1;