From: Dirk Koopman Date: Wed, 8 Dec 2021 22:37:45 +0000 (+0000) Subject: tidy up registered user handling a bit X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=23b5ee57c8db6a3269d41bf11f2264c074780b88;p=spider.git tidy up registered user handling a bit --- diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index c8decb72..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 @@ -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__