fix registration checking on call+ssid
authorDirk Koopman <djk@tobit.co.uk>
Wed, 8 Dec 2021 22:28:20 +0000 (22:28 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Wed, 8 Dec 2021 22:28:20 +0000 (22:28 +0000)
12 files changed:
Changes
cmd/announce.pl
cmd/chat.pl
cmd/dx.pl
cmd/reply.pl
cmd/send.pl
cmd/show/registered.pl
cmd/talk.pl
cmd/wx.pl
perl/DXCommandmode.pm
perl/cluster.pl
perl/console.pl

diff --git a/Changes b/Changes
index 64977c69faa16f6f3a91668ebc6a9b27f81e488a..35ec0ef1111ee3b373c2256bddd467d9b694e41f 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+08Nov21=======================================================================
+1. Get to the bottom of why ssid'd calls were using the base call's 
+   credentials. This should now work as expected. 
 06Nov21=======================================================================
 1. Improve console.pl scrolling. Split long lines (eg on announcements.
 04Nov21=======================================================================
index 7f52a461fafc952e0906c07b8ac8bfd873880685..962aebb6623acd925ba029dd5947132f2ec430f8 100644 (file)
@@ -20,7 +20,7 @@ my ($self, $line) = @_;
 my @f = split /\s+/, $line;
 return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
 return (1, $self->msg('e9')) if !@f;
-return (1, $self->msg('e28')) unless $self->registered;
+return (1, $self->msg('e28')) unless $self->isregistered;
 
 my $sort = uc $f[0];
 my $to = '*';
index b65ca928769b163b43c7d7305d0135e672df6f71..13018765d9c43caad44fe8b7ec78f74e0a7b756d 100644 (file)
@@ -13,7 +13,7 @@ my ($self, $line) = @_;
 my @f = split /\s+/, $line, 2;
 return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
 return (1, $self->msg('e34')) unless @f >= 1;
-return (1, $self->msg('e28')) unless $self->registered;
+return (1, $self->msg('e28')) unless $self->isregistered;
 
 my $target = uc $f[0];
 
index 97ed605f40000c326d33f8380e3c52731560ee52..27099f243a2a5f9dba15ec8034da0f3f1d6ca296 100644 (file)
--- a/cmd/dx.pl
+++ b/cmd/dx.pl
@@ -18,8 +18,10 @@ my $valid = 0;
 my $localonly;
 my $oline = $line;
 
+#$DB::single=1;
+
 return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
-return (1, $self->msg('e28')) unless $self->registered;
+return (1, $self->msg('e28')) unless $self->isregistered;
 
 my @bad;
 if (@bad = BadWords::check($line)) {   
@@ -60,7 +62,8 @@ my $ipaddr;
 my $addr = $self->hostname;
 
 if ($self->conn && $self->conn->peerhost) {
-       $ipaddr = $addr unless !is_ipaddr($addr) || $addr =~ /^127\./ || $addr =~ /^::[0-9a-f]+$/;
+#      $ipaddr = $addr unless !is_ipaddr($addr) || $addr =~ /^127\./ || $addr =~ /^::[0-9a-f]+$/;
+       $ipaddr = $addr; # force a PC61 
 } elsif ($self->inscript) {
        $ipaddr = "script";
 }
@@ -159,9 +162,10 @@ if ($freq =~ /^69/ || $localonly) {
 
        if ($ipaddr) {
                $spot = DXProt::pc61($spotter, $freq, $spotted, $line, $ipaddr);
-       } else {
-               $spot = DXProt::pc11($spotter, $freq, $spotted, $line);
        }
+       #else {
+       #       $spot = DXProt::pc11($spotter, $freq, $spotted, $line);
+       #}
        
        $self->dx_spot(undef, undef, @spot);
        if ($self->isslugged) {
index 292316b5018a0ce189805befc54ddf6692bba7b0..22f04b85bd98d9570318a4f861566c0f0887768e 100644 (file)
@@ -67,7 +67,7 @@ if ($self->state eq "prompt") {
                @extra = ();
        } 
 
-       return (1, $self->msg('e28')) unless $self->registered || $to eq $main::myalias;
+       return (1, $self->msg('e28')) unless $self->isregistered || $to eq $main::myalias;
        
        $loc->{to} = [ $to, @extra ];       # to is an array
        $loc->{subject} = $oref->subject;
index 08b2aa43ab8662dc3f577b440a09b8ee6db857a0..0fb91e10bc7ed3799f8f1014c50fe790b3304976 100644 (file)
@@ -39,7 +39,7 @@ if ($self->state eq "prompt") {
        
        # any thing after send?
        return (1, $self->msg('e6')) if !@f;
-       return (1, $self->msg('e28')) unless $self->registered || uc $f[0] eq $main::myalias;
+       return (1, $self->msg('e28')) unless $self->isregistered || uc $f[0] eq $main::myalias;
 
        while (@f) {
                my $f = uc shift @f; 
index 71ed0e38a4609c7b15cbd68827dd54a809b3e9de..4876aea2a7d6f9740f413eda68422f7f389b0afe 100644 (file)
@@ -62,6 +62,7 @@ sub generate
        }
 
        my @l;
+       push @out, "Registration is " . ($main::reqreg ? "Required" :  "NOT Required");
        foreach my $call (@val) {
                if (@l >= 5) {
                        push @out, sprintf "%-14s %-14s %-14s %-14s %-14s", @l;
index acd2eba54f84e6a70a73a826a18924b78532c70e..dae38e243be0d56b8f1378fd57e8f4bcf067e28b 100644 (file)
@@ -33,7 +33,7 @@ return (1, $self->msg('e8')) unless $to;
 $to = uc $to;
 
 return (1, $self->msg('e22', $to)) unless is_callsign($to);
-return (1, $self->msg('e28')) unless $self->registered || $to eq $main::myalias;
+return (1, $self->msg('e28')) unless $self->isregistered || $to eq $main::myalias;
 
 $via = uc $via if $via;
 my $call = $via || $to;
index 73e2e56677ba4fc678f4ed232cf7f7ea387bf6ab..571471909fac9677a1010a2afd6ba1f0dd8a9730 100644 (file)
--- a/cmd/wx.pl
+++ b/cmd/wx.pl
@@ -23,7 +23,7 @@ my $t = ztime(time);
 my $tonode;
 my $via;
 return (1, $self->msg('e5')) if $self->remotecmd || $self->inscript;
-return (1, $self->msg('e28')) unless $self->registered;
+return (1, $self->msg('e28')) unless $self->isregistered;
 
 if ($sort eq "FULL") {
   $line =~ s/^$f[0]\s+//;    # remove it
index a5ae268b34c2b601eb176482453057e17e4c6e75..13943472ca462ec70c2f7f23448ae560a5295730 100644 (file)
@@ -147,13 +147,11 @@ sub start
        $user->wantusstate(0) unless defined $user->{wantusstate};
 
        # sort out registration
-       if ($main::reqreg == 1) {
-               $self->{registered} = $user->registered;
-       } elsif ($main::reqreg == 2) {
+       if ($main::reqreg == 2) {
                $self->{registered} = !$user->registered;
        } else {
-               $self->{registered} = 1;
-       }
+               $self->{registered} = $user->registered;
+       } 
 
        # establish slug queue, if required
        $self->{sluggedpcs} = [];
@@ -1039,7 +1037,7 @@ sub format_dx_spot
                $comment = substr($comment, 0,  $clth-3) . ' ' . $_[12] if $_[12]; 
        }
 
-       return sprintf "DX de %-9.9s%9.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;
 }
 
 
@@ -1287,7 +1285,7 @@ sub send_motd
        my $self = shift;
        my $motd;
 
-       unless ($self->{registered}) {
+       unless ($self->isregistered) {
                $motd = "${main::motd}_nor_$self->{lang}";
                $motd = "${main::motd}_nor" unless -e $motd;
        }
@@ -1398,5 +1396,20 @@ sub user_count
 {
        return ($users, $maxusers);
 }
+
+sub isregistered
+{
+       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__
index 55e0badbcfd0484abd98606facb4253b00c4f2aa..9416a7f3a8578769a2a4152895433646cc00cc8b 100755 (executable)
@@ -263,8 +263,8 @@ sub new_channel
                        $lock = $user->lockout;
                } elsif ($basecall ne $call) {
                        # if there isn't a SSID on the $call, then try the base
-                       $user = DXUser::get_current($basecall);
-                       $lock = $user->lockout if $user;
+                       my $luser = DXUser::get_current($basecall);
+                       $lock = $luser->lockout if $luser;
                }
 
                # now deal with the lock
index faf7c5ce062890e26090264a64b4d617203e038f..c175122b2ee774ff307e304678c656ec508c1112 100755 (executable)
@@ -132,23 +132,6 @@ sub doresize
        do_initscr();
 
        $inscroll = 0;
-       dbg("resize: l=$lines c=$cols");
-       dbg("resize: sh=". scalar @sh );
-#      my @tsh;
-#      my $t;
-#      while (defined ($t = shift @sh)) {
-#              dbg("t: $t(" , length $t . ')'); 
-#              if ($t =~ /^\t/) {
-#                      $t =~ s/^\t/ /;
-#                      push(@tsh, pop(@tsh) . $t)
-#              } else {
-#                      push(@tsh, $t);
-#              }
-#              dbg("tsh: " . scalar @tsh);
-#      }
-#      dbg("resize: tsh=". scalar @tsh );
-#      $spos = @tsh < $pagel ? 0 :  @tsh - $pagel;
-       #       addtotop(@tsh);
        $spos = @sh < $pagel ? 0 :  @sh - $pagel;
        show_screen();
        $conn->send_later("C$call|$cols") if $conn;
@@ -184,17 +167,6 @@ sub setattr
        }
 }
 
-# measure the no of screen lines a line will take
-sub measure
-{
-       my $line = shift;
-       return 0 unless $line;
-
-       my $l = length $line;
-       my $lines = int ($l / $cols);
-       $lines++ if $l / $cols > $lines;
-       return $lines;
-}
 
 # display the top screen
 sub show_screen
@@ -203,11 +175,6 @@ sub show_screen
                
                dbg("B: s:$spos h:" . scalar @sh) if isdbg('console');
                my ($i, $l);
-#              for ($i = 0; $i < $pagel && $p >= 0; ) {
-#                      $l = measure($sh[$p]);
-#                      $i += $l;
-#                      $p-- if $i < $pagel;
-               #               }
 
                $spos = 0 if $spos < 0;
                my $y = $spos;
@@ -216,7 +183,6 @@ sub show_screen
                $top->clrtobot();
                for ($i = 0; $i < $pagel && $y < @sh; ++$y) {
                        my $line = $sh[$y];
-#                      my $lines = measure($line);
                        my $lines = 1;
                        $top->move($i, 0);
                        dbg("C: s:$spos y:$i sh:" . scalar @sh . " l:" . length($line) . " '$line'") if isdbg('console');
@@ -313,11 +279,6 @@ sub rec_stdin
                        $bot->clrtoeol();
                        $bot->addstr(substr($inbuf, 0, $cols));
 
-                       # add it to the monitor window
-#                      unless ($spos == @sh) {
-#                              $spos = @sh;
-#                              show_screen();
-#                      }
                        if ($inscroll && $spos < @sh) {
                                $spos = @sh - $pagel;
                                $inscroll = 0;
@@ -348,12 +309,6 @@ sub rec_stdin
                        }
                } elsif ($r eq KEY_PPAGE || $r eq "\032") {
                        if ($spos > 0 && @sh > $pagel) {
-#                              my ($i, $l);
-#                              for ($i = 0; $i < $pagel-1 && $spos >= 0; ) {
-#                                      $l = measure($sh[$spos]);
-#                                      $i += $l;
-#                                      --$spos if $i <= $pagel;
-#                              }
                                $spos -= $pagel+int($pagel/2); 
                                $spos = 0 if $spos < 0;
                                $inscroll = 1;
@@ -363,12 +318,6 @@ sub rec_stdin
                        }
                } elsif ($r eq KEY_NPAGE || $r eq "\026") {
                        if ($inscroll && $spos < @sh) {
-#                              my ($i, $l);
-#                              for ($i = 0; $i <= $pagel && $spos < @sh; ) {
-#                                      $l = measure($sh[$spos]);
-#                                      $i += $l;
-#                                      ++$spos if $i <= $pagel && $spos < @sh;
-#                              }
 
                                dbg("NPAGE sp:$spos $sh:". scalar @sh . " pl: $pagel") if isdbg('console');
                                $spos += int($pagel/2);