]> git.donarmstrong.com Git - infobot.git/blob - src/CLI/Support.pl
move cliloop to CLI ;-)
[infobot.git] / src / CLI / Support.pl
1 #
2 # CLI/Support.pl: Stubs for functions that are from IRC/*
3 #         Author: Tim Riker <Tim@Rikers.org>
4 #        Version: v0.1 (20021028)
5 #        Created: 20021028
6 #
7
8 sub cliloop {
9     &status("Using CLI...");
10     &status("Now type what you want.");
11
12     $nuh = "local!local\@local";
13     $uh  = "local\@local";
14     $who = "local";
15     $orig{who} = "local";
16     $ident = $param{'ircNick'};
17     $chan = $talkchannel = "_local";
18     $addressed = 1;
19     $msgType = 'public';
20
21     # install libterm-readline-gnu-perl to get history support
22     use Term::ReadLine;
23     $term = new Term::ReadLine 'blootbot';
24     $prompt = "$who> ";
25     #$OUT = $term->OUT || STDOUT;
26     while ( defined ($_ = $term->readline($prompt)) ) {
27         $orig{message} = $_;
28         $message = $_;
29         chomp $message;
30         last if ($message =~ m/^quit$/);
31         $_ = &process() if $message;
32     }
33     &doExit();
34 }
35
36 sub msg {
37     my ($nick, $msg) = @_;
38     if (!defined $nick) {
39         &ERROR("msg: nick == NULL.");
40         return;
41     }
42
43     if (!defined $msg) {
44         $msg ||= "NULL";
45         &WARN("msg: msg == $msg.");
46         return;
47     }
48
49     &status(">$nick< $msg");
50
51     print("$nick: $msg\n");
52 }
53
54 sub IsNickInChan {
55     my ($nick,$chan) = @_;
56     return 1;
57 }
58
59 sub performStrictReply {
60     &msg($who, @_);
61 }
62
63 sub performReply {
64     &msg($who, @_);
65 }
66
67 sub performAddressedReply {
68     return unless ($addressed);
69     &msg($who, @_);
70 }
71
72 sub pSReply {
73     &msg($who, @_);
74 }
75
76 1;