]> git.donarmstrong.com Git - infobot.git/blobdiff - src/CLI/Support.pl
* Add vim formatting comments ( # vim:ts=4:sw=4:expandtab:tw=80 )
[infobot.git] / src / CLI / Support.pl
index e61a1b367cb01ef1c8dad99c6c63dace390b47c7..33034a3f2481d5d92725396ffa227c9d7b82aec4 100644 (file)
@@ -4,6 +4,11 @@
 #        Version: v0.1 (20021028)
 #        Created: 20021028
 #
+use strict;
+
+my $postprocess;
+
+use vars qw($uh $message);
 
 sub cliloop {
     &status("Using CLI...");
@@ -11,17 +16,18 @@ sub cliloop {
 
     $nuh = "local!local\@local";
     $uh  = "local\@local";
-    $who = "local";
-    $orig{who} = "local";
-    $ident = $param{'ircNick'};
+    $who = 'local';
+    $orig{who} = 'local';
+    $ident = $param{'ircUser'};
     $chan = $talkchannel = "_local";
     $addressed = 1;
-    $msgType = 'public';
+    $msgType = 'private';
+    $host = 'local';
 
     # install libterm-readline-gnu-perl to get history support
     use Term::ReadLine;
-    $term = new Term::ReadLine 'blootbot';
-    $prompt = "$who> ";
+    my $term = new Term::ReadLine 'infobot';
+    my $prompt = "$who> ";
     #$OUT = $term->OUT || STDOUT;
     while ( defined ($_ = $term->readline($prompt)) ) {
        $orig{message} = $_;
@@ -41,11 +47,20 @@ sub msg {
     }
 
     if (!defined $msg) {
-       $msg ||= "NULL";
+       $msg ||= 'NULL';
        &WARN("msg: msg == $msg.");
        return;
     }
 
+    if ( $postprocess ) {
+       undef $postprocess;
+    } elsif ($postprocess = &getChanConf('postprocess', $talkchannel)) {
+       &DEBUG("say: $postprocess $msg");
+       &parseCmdHook($postprocess . ' ' . $msg);
+       undef $postprocess;
+       return;
+    }
+
     &status(">$nick< $msg");
 
     print("$nick: $msg\n");
@@ -85,8 +100,6 @@ sub performAddressedReply {
     &msg($who, @_);
 }
 
-sub pSReply {
-    &msg($who, @_);
-}
-
 1;
+
+# vim:ts=4:sw=4:expandtab:tw=80