]> dxcluster.net Git - spider.git/commitdiff
tidy up registered user handling a bit
authorDirk Koopman <djk@tobit.co.uk>
Wed, 8 Dec 2021 22:37:45 +0000 (22:37 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Wed, 8 Dec 2021 22:37:45 +0000 (22:37 +0000)
perl/DXCommandmode.pm

index c8decb72e1b3b5c39e34e2fd3f283d0f23741b54..cc694cc8821a970ad5bdcc217d7f7a84ccb3a1fe 100644 (file)
@@ -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
@@ -1237,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;
        }
@@ -1252,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__