]> dxcluster.org Git - spider.git/blob - cmd/disconnect.pl
add CTY-2103 prefixes
[spider.git] / cmd / disconnect.pl
1 #
2 # disconnect a local user
3 #
4 my ($self, $line) = @_;
5 my @calls = split /\s+/, $line;
6 my $call;
7 my @out;
8
9 if ($self->priv < 5) {
10         return (1, $self->msg('e5'));
11 }
12
13 if ($calls[0] =~ /^user/i ) {
14         @calls = grep {$_ ne $self->call} DXChannel::get_all_user_calls();
15 } elsif ($calls[0] =~ /^node/i) {
16         @calls = grep {$_ ne $main::mycall} DXChannel::get_all_node_calls();
17 } elsif (lc $calls[0] eq 'all') {
18         @calls = grep {$_ ne $main::mycall && $_ ne $self->call} DXChannel::get_all_node_calls(), DXChannel::get_all_user_calls();
19 }
20 foreach $call (@calls) {
21         $call = uc $call;
22         next if $call eq $main::mycall;
23         my $dxchan = DXChannel::get($call);
24         if ($dxchan) {
25                 if ($dxchan->is_node) {
26 #                       $dxchan->send_pc39($self->msg('disc1', $self->call));
27                 } else {
28                         return (1, $self->msg('e5')) if $self->priv < 8;
29                         $dxchan->send_now('D', $self->msg('disc1', $self->call));
30                 } 
31                 $dxchan->disconnect;
32                 push @out, $self->msg('disc2', $call);
33         } elsif (my $conn = Msg->conns($call)) {
34                 $conn->disconnect;
35                 push @out, $self->msg('disc3', $call);
36 #       } elsif (my $ref = DXCluster->get_exact($call)) {
37 #               my $dxchancall = $ref->dxchancall;
38 #               if ($dxchancall eq $main::mycall || !DXChannel::get($dxchancall)) {
39 #                       $ref->del;
40 #                       push @out, $self->msg('disc4', $call);
41 #               }
42         } else {
43                 push @out, $self->msg('e10', $call);
44         }
45 }
46
47 return (1, @out);