]> dxcluster.net Git - spider.git/blob - cmd/unset/register.pl
improve speed of sh/c/n (a bit)[probably].
[spider.git] / cmd / unset / register.pl
1 #
2 # unregister 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 unregister @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(0);
27                         $ref->put();
28                         my $dxchan = DXChannel::get($call);
29                         $dxchan->registered(0) if $dxchan;
30                         push @out, $self->msg("regun", $call);
31                         Log('DXCommand', $self->call . " unregistered $call");
32                 } else {
33                         push @out, $self->msg('e3', 'unset/register', $call);
34                 }
35         } else {
36                 Log('DXCommand', $self->call . " attempted to unregister $call remotely");
37                 push @out, $self->msg('sorry');
38         }
39 }
40 return (1, @out);