Change DXUser->get* to DXUser::get*
[spider.git] / cmd / connect.pl
index 7fb3b7f4cc40789039ad6186e862abb4e9637bc7..fd893974bb3673dfd87b921f1833afc7749a5a0d 100644 (file)
@@ -3,22 +3,22 @@
 #
 my $self = shift;
 my $call = uc shift;
-return (0) if $self->priv < 9;
+my $lccall = lc $call;
+
+return (1, $self->msg('e5')) if $self->priv < 5;
+return (1, $self->msg('e6')) unless $call gt ' ';
 return (1, $self->msg('already', $call)) if DXChannel::get($call);
+return (1, $self->msg('outconn', $call)) if grep {$_->{call} eq $call} @main::outstanding_connects;
+return (1, $self->msg('conscript', $lccall)) unless -e "$main::root/connect/$lccall";
+
+my $user = DXUser::get($call);
+return (1, $self->msg('lockout', $call)) if $user && $user->lockout;
 
-my $prog = "$main::root/local/client.pl";
-$prog = "$main::root/perl/client.pl" if ! -e $prog;
+my @out;
+push @out, $self->msg('constart', $call);
+ExtMsg::start_connect($call, "$main::root/connect/$lccall");
+return (1, @out);
 
-my $pid = fork();
-if (defined $pid) {
-       if (!$pid) {
-               # in child
-               exec $prog, $call, 'connect';
-       } else {
-               return(1, $self->msg('constart', $call));
-       }
-}
-return (0, $self->msg('confail', $call, $!))