]> dxcluster.net Git - spider.git/blob - cmd/set/node.pl
try fix node type changes from outside
[spider.git] / cmd / set / node.pl
1 #
2 # set user type to 'A' for AK1A node
3 #
4 # Please note that this is only effective if the user is not on-line
5 #
6 # Copyright (c) 1998 - Dirk Koopman
7 #
8 #
9 #
10
11 my ($self, $line) = @_;
12 my @args = split /\s+/, $line;
13 my $call;
14 my @out;
15 my $user;
16 my $create;
17
18 return (1, $self->msg('e5')) if $self->priv < 5;
19
20 foreach $call (@args) {
21         $call = uc $call;
22         if ($call eq $main::mycall) {
23                 push @out, $self->msg('e11', $call);
24                 next;
25         }
26         if ($call eq $main::myalias) {
27                 push @out, $self->msg('e11', $call);
28                 next;
29         }
30         my $chan = DXChannel::get($call);
31         if ($chan) {
32                 push @out, $self->msg('nodee1', $call);
33         } else {
34                 $user = DXUser::get($call);
35                 $create = !$user;
36                 $user = DXUser->new($call) if $create;
37                 if ($user) {
38                         $user->sort('A');
39                         $user->homenode($call);
40                         $user->lockout(0);
41                         $user->priv(1) unless $user->priv;
42                         $user->close();
43                         push @out, $self->msg($create ? 'nodeac' : 'nodea', $call);
44                 } else {
45                         push @out, $self->msg('e3', "Set Node", $call);
46                 }
47         }
48 }
49 return (1, @out);