- my ($self, $line, $sort) = @_;
- my $user = $self->{user};
- my $call = $self->{call};
- my $name = $user->{name};
-
- $self->{name} = $name ? $name : $call;
- $self->send($self->msg('l2',$self->{name}));
- $self->send_file($main::motd) if (-e $main::motd);
- $self->state('prompt'); # a bit of room for further expansion, passwords etc
- $self->{priv} = $user->priv;
- $self->{lang} = $user->lang;
- $self->{pagelth} = 20;
- $self->{priv} = 0 if $line =~ /^(ax|te)/; # set the connection priv to 0 - can be upgraded later
- $self->{consort} = $line; # save the connection type
-
- # set some necessary flags on the user if they are connecting
- $self->{wwv} = $self->{talk} = $self->{ann} = $self->{here} = $self->{dx} = 1;
-# $self->prompt() if $self->{state} =~ /^prompt/o;
-
- # add yourself to the database
- my $node = DXNode->get($main::mycall) or die "$main::mycall not allocated in DXNode database";
- my $cuser = DXNodeuser->new($self, $node, $call, 0, 1);
- $node->dxchan($self) if $call eq $main::myalias; # send all output for mycall to myalias
-
- # issue a pc16 to everybody interested
- my $nchan = DXChannel->get($main::mycall);
- my @pc16 = DXProt::pc16($nchan, $cuser);
- DXProt::broadcast_ak1a(@pc16);
- Log('DXCommand', "$call connected");
-
- # send prompts and things
- my $info = DXCluster::cluster();
- $self->send("Cluster:$info");
- $self->send($self->msg('pr', $call));
+ my ($self, $line, $sort) = @_;
+ my $user = $self->{user};
+ my $call = $self->{call};
+ my $name = $user->{name};
+
+ # log it
+ my $host = $self->{conn}->{peerhost} || "unknown";
+ Log('DXCommand', "$call connected from $host");
+
+ $self->{name} = $name ? $name : $call;
+ $self->send($self->msg('l2',$self->{name}));
+ $self->send_file($main::motd) if (-e $main::motd);
+ $self->state('prompt'); # a bit of room for further expansion, passwords etc
+ $self->{priv} = $user->priv || 0;
+ $self->{lang} = $user->lang || $main::lang || 'en';
+ $self->{pagelth} = $user->pagelth || 20;
+ $self->{priv} = 0 if $line =~ /^(ax|te)/; # set the connection priv to 0 - can be upgraded later
+ ($self->{width}) = $line =~ /width=(\d+)/;
+ $self->{width} = 80 unless $self->{width} && $self->{width} > 80;
+ $self->{consort} = $line; # save the connection type
+
+ # set some necessary flags on the user if they are connecting
+ $self->{beep} = $user->wantbeep;
+ $self->{ann} = $user->wantann;
+ $self->{wwv} = $user->wantwwv;
+ $self->{wcy} = $user->wantwcy;
+ $self->{talk} = $user->wanttalk;
+ $self->{wx} = $user->wantwx;
+ $self->{dx} = $user->wantdx;
+ $self->{logininfo} = $user->wantlogininfo;
+ $self->{ann_talk} = $user->wantann_talk;
+ $self->{here} = 1;
+
+ # get the filters
+ $self->{spotsfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'user_default', 0);
+ $self->{wwvfilter} = Filter::read_in('wwv', $call, 0) || Filter::read_in('wwv', 'user_default', 0);
+ $self->{wcyfilter} = Filter::read_in('wcy', $call, 0) || Filter::read_in('wcy', 'user_default', 0);
+ $self->{annfilter} = Filter::read_in('ann', $call, 0) || Filter::read_in('ann', 'user_default', 0) ;
+
+ # clean up qra locators
+ my $qra = $user->qra;
+ $qra = undef if ($qra && !DXBearing::is_qra($qra));
+ unless ($qra) {
+ my $lat = $user->lat;
+ my $long = $user->long;
+ $user->qra(DXBearing::lltoqra($lat, $long)) if (defined $lat && defined $long);
+ }
+
+ # send prompts and things
+ my $info = Route::cluster();
+ $self->send("Cluster:$info");
+ $self->send($self->msg('namee1')) if !$user->name;
+ $self->send($self->msg('qthe1')) if !$user->qth;
+ $self->send($self->msg('qll')) if !$user->qra || (!$user->lat && !$user->long);
+ $self->send($self->msg('hnodee1')) if !$user->qth;
+ $self->send($self->msg('m9')) if DXMsg::for_me($call);
+ $self->prompt;
+
+ # decide on echo
+ if (!$user->wantecho) {
+ $self->send_now('E', "0");
+ $self->send($self->msg('echow'));
+ }
+
+ $self->tell_login('loginu');
+
+ # do we need to send a forward/opernam?
+ my $lastoper = $user->lastoper || 0;
+ my $homenode = $user->homenode || "";
+ if ($homenode eq $main::mycall && $lastoper + $DXUser::lastoperinterval < $main::systime) {
+ run_cmd($DXProt::me, "forward/opernam $call");
+ $user->lastoper($main::systime);
+ }
+
+ # run a script send the output to the punter
+ my $script = new Script(lc $call);
+ $script->run($self) if $script;