fix longstanding issues with console EOL handling
[spider.git] / perl / DXCommandmode.pm
index 900460aef2c1df89f65fb48b1a97fd1ef7bb3eeb..e6b612fad342942b8733a6e9fce402aaa2e86ac7 100644 (file)
@@ -136,6 +136,7 @@ sub start
        $self->{dx} = $user->wantdx;
        $self->{logininfo} = $user->wantlogininfo;
        $self->{ann_talk} = $user->wantann_talk;
+       $self->{wantrbn} = $user->wantrbn;
        $self->{here} = 1;
        $self->{prompt} = $user->prompt if $user->prompt;
        $self->{lastmsgpoll} = 0;
@@ -176,7 +177,10 @@ sub start
        $self->{annfilter} = Filter::read_in('ann', $call, 0) 
                || Filter::read_in('ann', $nossid, 0) 
                        || Filter::read_in('ann', 'user_default', 0) ;
-
+       $self->{rbnfilter} = Filter::read_in('rbn', $call, 0) 
+               || Filter::read_in('rbn', $nossid, 0)
+               || Filter::read_in('rbn', 'user_default', 0);
+       
        # clean up qra locators
        my $qra = $user->qra;
        $qra = undef if ($qra && !DXBearing::is_qra($qra));
@@ -992,18 +996,11 @@ sub format_dx_spot
 
        my $t = ztime($_[2]);
        my $loc = '';
-       my $clth = $self->{consort} eq 'local' ? 29 : 30;
+       my $clth = 30;
+       --$clth if $self->{consort} eq 'local';
+       
        my $comment = substr (($_[3] || ''), 0, $clth);
        $comment .= ' ' x ($clth - (length($comment)));
-       if ($self->{user}->wantgrid) {
-               my $ref = DXUser::get_current($_[1]);
-               if ($ref && $ref->qra) {
-                       $loc = ' ' . substr($ref->qra, 0, 4);
-                       $comment = substr $comment, 0,  ($clth - (length($comment)+length($loc)));
-                       $comment .= $loc;
-                       $loc = '';
-               }
-       }
        
        if ($self->{user}->wantgrid) {
                my $ref = DXUser::get_current($_[4]);
@@ -1012,15 +1009,23 @@ sub format_dx_spot
                }
        }
 
-       if ($self->{user}->wantdxitu) {
+    if ($self->{user}->wantgrid) {
+               my $ref = DXUser::get_current($_[1]);
+               if ($ref && $ref->qra) {
+                       $loc = ' ' . substr($ref->qra, 0, 4);
+                       $comment = substr $comment, 0,  ($clth - (length($comment)+length($loc)));
+                       $comment .= $loc;
+                       $loc = '';
+               }
+       } elsif ($self->{user}->wantdxitu) {
                $loc = ' ' . sprintf("%2d", $_[10]) if defined $_[10];
-               $comment = substr($comment, 0,  $self->{consort} eq 'local' ? 26 : 27) . ' ' . sprintf("%2d", $_[8]) if defined $_[8]; 
+               $comment = substr($comment, 0,  $clth-3) . ' ' . sprintf("%2d", $_[8]) if defined $_[8]; 
        } elsif ($self->{user}->wantdxcq) {
                $loc = ' ' . sprintf("%2d", $_[11]) if defined $_[11];
-               $comment = substr($comment, 0,  $self->{consort} eq 'local' ? 26 : 27) . ' ' . sprintf("%2d", $_[9]) if defined $_[9]; 
+               $comment = substr($comment, 0, $clth-3) . ' ' . sprintf("%2d", $_[9]) if defined $_[9]; 
        } elsif ($self->{user}->wantusstate) {
                $loc = ' ' . $_[13] if $_[13];
-               $comment = substr($comment, 0,  $self->{consort} eq 'local' ? 26 : 27) . ' ' . $_[12] if $_[12]; 
+               $comment = substr($comment, 0,  $clth-3) . ' ' . $_[12] if $_[12]; 
        }
 
        return sprintf "DX de %-7.7s%11.1f  %-12.12s %-s $t$loc", "$_[4]:", $_[0], $_[1], $comment;