-# add a line to the end of the top screen
-sub addtotop
-{
- while (@_) {
- my $inbuf = shift;
- if ($inbuf =~ s/\x07+$//) {
- beep();
- }
- $inbuf =~ s/\s+$//s;
- if (length $inbuf > $cols) {
- $Text::Wrap::Columns = $cols;
- push @shistory, wrap('',"\t", $inbuf);
- } else {
- push @shistory, $inbuf;
- }
- shift @shistory while @shistory > $maxshist;
- }
- show_screen();
-}
-
-# handle incoming messages
-sub rec_socket
-{
- my ($con, $msg, $err) = @_;
- if (defined $err && $err) {
- cease(1);
- }
- if (defined $msg) {
- my ($sort, $incall, $line) = $msg =~ /^(\w)([^\|]+)\|(.*)$/;
-
- # change my call if my node says "tonight Michael you are Jane" or something like that...
- $call = $incall if $call ne $incall;
-
- $line =~ s/[\x00-\x06\x08\x0a-\x19\x1b-\x1f\x80-\x9f]/./g; # immutable CSI sequence + control characters
- if ($sort && $sort eq 'D') {
- $line = " " unless length($line);
- addtotop($line);
- } elsif ($sort && $sort eq 'Z') { # end, disconnect, go, away .....
- cease(0);
- }
- # ******************************************************
- # ******************************************************
- # any other sorts that might happen are silently ignored.
- # ******************************************************
- # ******************************************************
- } else {
- cease(0);
- }
- $top->refresh();
- $lasttime = time;
-}
-