Make sure that a privilege is always defined even if it is 0
[spider.git] / perl / DXCommandmode.pm
index ca6a1c4e989cbc264c4b72cf698a6197bf7a6c93..60626ef41722ba1bb13bca65ceb6d60b09dfb906 100644 (file)
@@ -64,8 +64,8 @@ sub start
        $self->send($self->msg('l2',$self->{name}));
        $self->send_file($main::motd) if (-e $main::motd);
        $self->state('prompt');         # a bit of room for further expansion, passwords etc
-       $self->{priv} = $user->priv;
-       $self->{lang} = $user->lang;
+       $self->{priv} = $user->priv || 0;
+       $self->{lang} = $user->lang || 'en';
        $self->{pagelth} = $user->pagelth || 20;
        $self->{priv} = 0 if $line =~ /^(ax|te)/; # set the connection priv to 0 - can be upgraded later
        $self->{consort} = $line;       # save the connection type
@@ -80,7 +80,15 @@ sub start
        $self->{dx} = $user->wantdx;
        $self->{logininfo} = $user->wantlogininfo;
        $self->{here} = 1;
-       
+
+       # clean up qra locators
+       my $qra = $user->qra;
+       $qra = undef if ($qra && !DXBearing::is_qra($qra));
+       unless ($qra) {
+               my $lat = $user->lat;
+               my $long = $user->long;
+               $user->qra(DXBearing::lltoqra($lat, $long)) if (defined $lat && defined $long);  
+       }
 
        # add yourself to the database
        my $node = DXNode->get($main::mycall) or die "$main::mycall not allocated in DXNode database";