X-Git-Url: http://gb7djk.dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXCommandmode.pm;h=cc694cc8821a970ad5bdcc217d7f7a84ccb3a1fe;hb=23b5ee57c8db6a3269d41bf11f2264c074780b88;hp=35c92341d17cbc896a0a64d6941e9a3d156dea77;hpb=d48efa42552b206692cf5f5ec60fb492149b87b0;p=spider.git diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index 35c92341..cc694cc8 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -124,13 +124,11 @@ sub start $user->wantdxitu(0) unless defined $user->{wantdxitu}; $user->wantusstate(0) unless defined $user->{wantusstate}; - # sort out registration - if ($main::reqreg == 1) { - $self->{registered} = $user->registered; - } elsif ($main::reqreg == 2) { + # sort out registration (who wanted 2???) Note registration *could* be used even when reqreg == 0 + if ($main::reqreg == 2) { $self->{registered} = !$user->registered; } else { - $self->{registered} = 1; + $self->{registered} = $user->registered; } # send the relevant MOTD @@ -960,29 +958,40 @@ sub format_dx_spot my $t = ztime($_[2]); my $loc = ''; - my $clth = $self->{consort} eq 'local' ? 29 : 30; + + my $clth = 30 + $self->{width} - 80; # allow comment to grow according the screen width + # --$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($_[4]); - if ($ref) { - $loc = $ref->qra || ''; - $loc = ' ' . substr($loc, 0, 4) if $loc; + $comment =~ s/\t/ /g; + + $comment .= ' ' x ($clth - (length($comment))); + + if ($self->{user}->wantgrid) { + my $ref = DXUser::get_current($_[1]); + if ($ref && $ref->qra) { + my $cloc = ' ' . substr($ref->qra, 0, 4); + $comment = substr $comment, 0, ($clth - (length($comment)+length($cloc))); + $comment .= $cloc; } - } - - if ($self->{user}->wantdxitu) { + my $origin = $_[4]; + $origin =~ s/-#$//; # sigh...... + $ref = DXUser::get_current($origin); + if ($ref && $ref->qra) { + $loc = ' ' . substr($ref->qra, 0, 4); + } + } 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; + return sprintf "DX de %-8.8s%10.1f %-12.12s %-s $t$loc", "$_[4]:", $_[0], $_[1], $comment; } # send a dx spot @@ -1226,7 +1235,7 @@ sub send_motd my $self = shift; my $motd; - unless ($self->{registered}) { + unless ($self->registered) { $motd = "${main::motd}_nor_$self->{lang}"; $motd = "${main::motd}_nor" unless -e $motd; } @@ -1241,5 +1250,20 @@ sub send_motd } $self->send_file($motd) if -e $motd; } + +sub registered +{ + my $self = shift; + + # the sysop is registered! + return 1 if $self->call eq $main::myalias || $self->call eq $main::mycall; + + if ($main::reqreg) { + return $self->{registered}; + } else { + return 1; + } +} + 1; __END__