3 # this is the operators console.
7 # console.pl [callsign]
9 # if the callsign isn't given then the sysop callsign in DXVars.pm is assumed
11 # Copyright (c) 1999 Dirk Koopman G1TLH
18 # search local then perl directories
20 # root of directory tree for this system
22 $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
24 unshift @INC, "$root/perl"; # this IS the right way round!
25 unshift @INC, "$root/local";
36 # cease communications
40 if ($conn && $sendz) {
41 $conn->send_now("Z$call|bye...\n");
45 # $SIG{__WARN__} = sub {my $a = shift; cluck($a); };
50 # terminate program from signal
56 # handle incoming messages
59 my ($con, $msg, $err) = @_;
60 if (defined $err && $err) {
64 my ($sort, $call, $line) = $msg =~ /^(\w)(\S+)\|(.*)$/;
67 $top->addstr("$line\n");
68 } elsif ($sort eq 'Z') { # end, disconnect, go, away .....
83 # $prbuf =~ s/\r/\\r/;
84 # $prbuf =~ s/\n/\\n/;
85 # print "sys: $r ($prbuf)\n";
87 if ($r eq "\n" || $r eq "\r") {
88 $inbuf = " " unless $inbuf;
89 $conn->send_later("I|$call|$inbuf");
103 $call = ""; # the callsign being used
104 $conn = 0; # the connection object for the cluster
105 $lasttime = time; # lasttime something happened on the interface
113 $call = uc shift @ARGV if @ARGV;
114 $call = uc $myalias if !$call;
116 if ($call eq $mycall) {
117 print "You cannot connect as your cluster callsign ($mycall)\n";
121 $conn = Msg->connect("$clusteraddr", $clusterport, \&rec_socket);
123 if (-r "$data/offline") {
124 open IN, "$data/offline" or die;
130 print "Sorry, the cluster $mycall is currently off-line\n";
136 $SIG{'INT'} = \&sig_term;
137 $SIG{'TERM'} = \&sig_term;
138 $SIG{'HUP'} = 'IGNORE';
142 $top = $scr->subwin(LINES()-4, COLS, 0, 0);
145 $scr->addstr(LINES()-4, 0, '-' x COLS);
146 $bot = $scr->subwin(3, COLS, LINES()-3, 0);
154 $conn->send_now("A$call|$connsort");
155 $conn->send_now("I|$call|set/page $pages");
156 $conn->send_now("I|$call|set/nobeep");
158 Msg->set_event_handler(\*STDIN, "read" => \&rec_stdin);
162 Msg->event_loop(1, 0.010);
163 $top->refresh() if $top->is_wintouched;
166 if ($t > $lasttime) {