-
- # set up the basic channel info - this needs a bit more thought - there is duplication here
- if (!defined $dxchan) {
- my ($sort, $call, $line) = $msg =~ /^(\w)(\S+)\|(.*)$/;
-
- # is there one already connected?
- if (DXChannel->get($call)) {
- my $mess = DXM::msg($lang, 'conother', $call);
- dbg('chan', "-> D $call $mess\n");
- $conn->send_now("D$call|$mess");
- sleep(1);
- dbg('chan', "-> Z $call bye\n");
- $conn->send_now("Z$call|bye"); # this will cause 'client' to disconnect
- return;
- }
-
- # is there one already connected elsewhere in the cluster (and not a cluster)
- my $user = DXUser->get($call);
- if ($user && $user->sort eq 'A' && !DXCluster->get_exact($call)) {
- ;
- } elsif (($call eq $main::myalias && DXCluster->get_exact($call)) ||
- DXCluster->get($call)) {
- my $mess = DXM::msg($lang, 'concluster', $call);
- dbg('chan', "-> D $call $mess\n");
- $conn->send_now("D$call|$mess");
- sleep(1);
- dbg('chan', "-> Z $call bye\n");
- $conn->send_now("Z$call|bye"); # this will cause 'client' to disconnect
+
+ # set up the basic channel info
+ # is there one already connected to me - locally?
+ my $user = DXUser->get_current($call);
+ my $dxchan = DXChannel->get($call);
+ if ($dxchan) {
+ my $mess = DXM::msg($lang, ($user && $user->is_node) ? 'concluster' : 'conother', $call, $main::mycall);
+ already_conn($conn, $call, $mess);
+ return;
+ }
+
+ # is he locked out ?
+ my $basecall = $call;
+ $basecall =~ s/-\d+$//;
+ my $baseuser = DXUser->get_current($basecall);
+ my $lock = $user->lockout if $user;
+ if ($baseuser && $baseuser->lockout || $lock) {
+ if (!$user || !defined $lock || $lock) {
+ my $host = $conn->{peerhost} || "unknown";
+ Log('DXCommand', "$call on $host is locked out, disconnected");
+ $conn->disconnect;