]> dxcluster.net Git - spider.git/blob - cmd/set/register.pl
fix WWV brodacasting and filtering
[spider.git] / cmd / set / register.pl
1 #
2 # register a user
3 #
4 # Copyright (c) 2001 Dirk Koopman G1TLH
5 #
6 # $Id$
7 #
8 my ($self, $line) = @_;
9 my @args = split /\s+/, $line;
10 my $call;
11 # my $priv = shift @args;
12 my @out;
13 my $user;
14 my $ref;
15
16 if ($self->priv < 9) {
17         Log('DXCommand', $self->call . " attempted to register @args");
18         return (1, $self->msg('e5'));
19 }
20 return (1, $self->msg('reginac')) unless $main::reqreg;
21
22 foreach $call (@args) {
23         $call = uc $call;
24         unless ($self->remotecmd || $self->inscript) {
25                 if ($ref = DXUser->get_current($call)) {
26                         $ref->registered(1);
27                         $ref->put();
28                         push @out, $self->msg("reg", $call);
29                 } else {
30                         $ref = DXUser->new($call);
31                         $ref->registered(1);
32                         $ref->put();
33                         push @out, $self->msg("regc", $call);
34                 }
35                 my $dxchan = DXChannel::get($call);
36                 $dxchan->registered(1) if $dxchan;
37                 Log('DXCommand', $self->call . " registered $call");
38         } else {
39                 Log('DXCommand', $self->call . " attempted to register $call remotely");
40                 push @out, $self->msg('sorry');
41         }
42 }
43 return (1, @out);