]> dxcluster.net Git - spider.git/blob - cmd/set/obscount.pl
improve speed of sh/c/n (a bit)[probably].
[spider.git] / cmd / set / obscount.pl
1 #
2 # set ping interval for this node
3 #
4 # Copyright (c) 1998 - Dirk Koopman
5 #
6 # $Id$
7 #
8
9 my ($self, $line) = @_;
10 my @args = split /\s+/, $line;
11 my $call;
12 my @out;
13 my $user;
14 my $val = shift @args if @args;
15
16
17 return (1, $self->msg('e5')) if $self->priv < 8;
18 return (1, $self->msg('e25', 1, 9)) unless defined $val && $val =~ /^\d+$/ && $val >= 1 && $val <= 9;
19 return (1, $self->msg('e12')) unless @args;
20
21 foreach $call (@args) {
22         $call = uc $call;
23         my $dxchan = DXChannel::get($call);
24         $user = $dxchan->user if $dxchan;
25         $user = DXUser->get_current($call);
26         if ($user) {
27                 unless ($user->is_node) {
28                         push @out, $self->msg('e13', $call);
29                         next;
30                 }
31                 $user->nopings($val);
32                 if ($dxchan) {
33                         $dxchan->nopings($val);
34                 } else {
35                         $user->close();
36                 }
37                 push @out, $self->msg('obscount', $call, $val);
38         } else {
39                 push @out, $self->msg('e3', "set/obscount", $call);
40         }
41 }
42 return (1, @out);