Add set/maxconnect command
[spider.git] / cmd / set / maxconnect.pl
diff --git a/cmd/set/maxconnect.pl b/cmd/set/maxconnect.pl
new file mode 100644 (file)
index 0000000..715b355
--- /dev/null
@@ -0,0 +1,31 @@
+#
+# set the maximum no of connections this user/node can have
+# whilst connecting to this node
+#
+# Copyright (c) 2008 - Dirk Koopman G1TLH
+#
+
+my ($self, $line) = @_;
+my @args = split /\s+/, $line;
+my $call;
+my @out;
+my $user;
+my $val = shift @args if @args;
+
+
+return (1, $self->msg('e5')) if $self->priv < 8;
+return (1, $self->msg('e14')) unless defined $val;
+return (1, $self->msg('e12')) unless @args;
+
+foreach $call (@args) {
+       $call = uc $call;
+       $user = DXUser::get_current($call);
+       if ($user) {
+               $user->maxconnect($val);
+               $user->put;
+               push @out, $self->msg('maxconnect', $call, $val);
+       } else {
+               push @out, $self->msg('e3', "set/maxconnect", $call);
+       }
+}
+return (1, @out);