- # 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 elsewhere in the cluster (and not a cluster)
- my $user = DXUser->get($call);
- if ($user) {
- if (($user->sort eq 'A' || $call == $myalias) && !DXCluster->get_exact($call)) {
- ;
- } else {
- if (DXCluster->get($call) || DXChannel->get($call)) {
- my $mess = DXM::msg($lang, $user->sort eq 'A' ? 'concluster' : 'conother', $call);
- already_conn($conn, $call, $mess);
+ if (is_webcall($call) && $conn->isa('IntMsg')) {
+ my $newcall = find_next_webcall();
+ unless ($newcall) {
+ already_conn($conn, $call, "Maximum no of web connected connects ($Web::maxssid) exceeded");
+ return;
+ }
+ $call = $newcall;
+ $user = DXUser::get_current($call);
+ unless ($user) {
+ $user = DXUser->new($call);
+ $user->sort('W');
+ $user->wantbeep(0);
+ $user->name('web');
+ $user->qth('on the web');
+ $user->homenode($main::mycall);
+ $user->lat($main::mylatitude);
+ $user->long($main::mylongitude);
+ $user->qra($main::mylocator);
+ }
+ $user->startt($main::systime);
+ $conn->conns($call);
+ $dxchan = Web->new($call, $conn, $user);
+ $dxchan->enhanced(1);
+ $dxchan->ve7cc(1);
+ $msg =~ s/^A#WEB|/A$call|/;
+ $conn->send_now("C$call");
+ } else {
+ # "Normal" connections
+ unless (is_callsign($call)) {
+ already_conn($conn, $call, DXM::msg($lang, "illcall", $call));
+ return;
+ }
+
+ # is he locked out ?
+ my $basecall = $call;
+ $basecall =~ s/-\d+$//; # remember this for later multiple user processing
+ 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;
+ LogDbg('DXCommand', "$call on $host is locked out, disconnected");
+ $conn->disconnect;
+ return;
+ }
+ }
+
+ # set up the basic channel info for "Normal" Users
+ # is there one already connected to me - locally?
+
+ $user = DXUser::get_current($call);
+ $dxchan = DXChannel::get($call);
+ my $newcall = $call;
+ if ($dxchan) {
+ if ($user && $user->is_node) {
+ already_conn($conn, $call, DXM::msg($lang, 'conother', $call, $main::mycall));
+ return;
+ }
+ if ($allowmultiple && $user->is_user) {
+ # determine whether we are a candidate, have we flip-flopped frequently enough?
+ my @lastconns = @{$user->connlist} if $user->connlist;
+ my $allow = 0;
+ if (@lastconns >= $DXUser::maxconnlist) {
+ $allow = $lastconns[-1]->[0] - $lastconns[0]->[0] < $min_reconnection_rate;
+ }
+ # search for a spare ssid
+ L1: for (my $count = $call =~ /-\d+$/?0:1; $allow && $count < $allowmultiple; ) { # remember we have one call already
+ my $lastid = 1;
+ for (; $lastid < $max_ssid && $count < $allowmultiple; ++$lastid) {
+ my $chan = DXChannel::get("$basecall-$lastid");
+ if ($chan) {
+ ++$count;
+ next;
+ }
+ # we have a free call-ssid, save it
+ $newcall = "$basecall-$lastid";
+ last L1;
+ }
+ }
+ }
+
+ # handle "normal" (non-multiple) connections in the existing way
+ if ($call eq $newcall) {
+ if ($bumpexisting) {
+ my $ip = $dxchan->hostname;
+ $dxchan->send_now('D', DXM::msg($lang, 'conbump', $call, $ip));
+ LogDbg('DXCommand', "$call bumped off by $ip, disconnected");
+ $dxchan->disconnect;
+ } else {
+ already_conn($conn, $call, DXM::msg($lang, 'conother', $call, $main::mycall));