%Cache = (); # cache of dynamically loaded routine's mod times
%cmd_cache = (); # cache of short names
$errstr = (); # error string from eval
%aliases = (); # aliases for (parts of) commands
$scriptbase = "$main::root/scripts"; # the place where all users start scripts go
%Cache = (); # cache of dynamically loaded routine's mod times
%cmd_cache = (); # cache of short names
$errstr = (); # error string from eval
%aliases = (); # aliases for (parts of) commands
$scriptbase = "$main::root/scripts"; # the place where all users start scripts go
+
+ # routing, this must go out here to prevent race condx
+ my $pkg = shift;
+ my $call = shift;
+ my @rout = $main::routeroot->add_user($call, Route::here(1));
+ DXProt::route_pc16($DXProt::me, $main::routeroot, @rout) if @rout;
+
$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->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->{pagelth} = $user->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
$self->{pagelth} = $user->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
- $self->{spotfilter} = Filter::read_in('spots', $call, 0) || Filter::read_in('spots', 'user_default', 0);
+ $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) ;
$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) ;
- # 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
+ $DXProt::me->conn($self->conn) 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);
- for (@pc16) {
- DXProt::broadcast_all_ak1a($_);
- }
Log('DXCommand', "$call connected");
# send prompts and things
Log('DXCommand', "$call connected");
# send prompts and things
$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->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);
my ($to, $via) = $ent =~ /(\S+)>(\S+)/;
$to = $ent unless $to;
my $call = $via ? $via : $to;
my ($to, $via) = $ent =~ /(\S+)>(\S+)/;
$to = $ent unless $to;
my $call = $via ? $via : $to;
my $dxchan = $clref->dxchan if $clref;
if ($dxchan) {
$dxchan->talk($self->{call}, $to, $via, $line);
my $dxchan = $clref->dxchan if $clref;
if ($dxchan) {
$dxchan->talk($self->{call}, $to, $via, $line);
# split the command line up into parts, the first part is the command
my ($cmd, $args) = split /\s+/, $cmdline, 2;
# split the command line up into parts, the first part is the command
my ($cmd, $args) = split /\s+/, $cmdline, 2;
# alias it if possible
my $acmd = CmdAlias::get_cmd($cmd);
if ($acmd) {
($cmd, $args) = split /\s+/, "$acmd $args", 2;
# alias it if possible
my $acmd = CmdAlias::get_cmd($cmd);
if ($acmd) {
($cmd, $args) = split /\s+/, "$acmd $args", 2;
- $args = "" unless $args;
- dbg('command', "aliased cmd: $cmd $args");
+ $args = "" unless defined $args;
+ dbg("aliased cmd: $cmd $args") if isdbg('command');
($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd;
if ($path && $cmd) {
($path, $fcmd) = search($main::cmd, $cmd, "pl") if !$path || !$fcmd;
if ($path && $cmd) {
my $package = find_cmd_name($path, $fcmd);
@ans = (0) if !$package ;
if ($package) {
my $package = find_cmd_name($path, $fcmd);
@ans = (0) if !$package ;
if ($package) {
- dbg('command', "cmd: $cmd not found");
- return ($self->msg('e1'));
+ dbg("cmd: $cmd not found") if isdbg('command');
+ if (++$self->{errors} > $maxerrors) {
+ $self->send($self->msg('e26'));
+ $self->disconnect;
+ return ();
+ } else {
+ return ($self->msg('e1'));
+ }
- # I was the last node visited
- $self->user->node($main::mycall);
-
- # log out text
- if ($conn && -e "$main::data/logout") {
- open(I, "$main::data/logout") or confess;
- my @in = <I>;
- close(I);
- $self->send_now('D', @in);
- sleep(1);
+ # reset the redirection of messages back to 'normal' if we are the sysop
+ if ($call eq $main::myalias) {
+ $DXProt::me->conn(undef);
-# if ($call eq $main::myalias) { # unset the channel if it is us really
-# my $node = DXNode->get($main::mycall);
-# $node->{dxchan} = 0;
-# }
-
+ my @rout = $main::routeroot->del_user($call);
+ dbg("B/C PC17 on $main::mycall for: $call") if isdbg('route');
+
- my $nchan = DXChannel->get($main::mycall);
- my $pc17 = $nchan->pc17($self);
- DXProt::broadcast_all_ak1a($pc17);
+ DXProt::route_pc17($DXProt::me, $main::routeroot, @rout) if @rout;
# send info to all logged in thingies
$self->tell_login('logoutu');
Log('DXCommand', "$call disconnected");
# send info to all logged in thingies
$self->tell_login('logoutu');
Log('DXCommand', "$call disconnected");
# return immediately if we have it
($apath, $acmd) = split ',', $cmd_cache{$short_cmd} if $cmd_cache{$short_cmd};
if ($apath && $acmd) {
# return immediately if we have it
($apath, $acmd) = split ',', $cmd_cache{$short_cmd} if $cmd_cache{$short_cmd};
if ($apath && $acmd) {
next if $l =~ /^\./;
if ($i < $#parts) { # we are dealing with directories
if ((-d "$curdir/$l") && $p eq substr($l, 0, length $p)) {
next if $l =~ /^\./;
if ($i < $#parts) { # we are dealing with directories
if ((-d "$curdir/$l") && $p eq substr($l, 0, length $p)) {
# chop $dirfn; # remove trailing /
$dirfn = "" unless $dirfn;
$cmd_cache{"$short_cmd"} = join(',', ($path, "$dirfn$l")); # cache it
# chop $dirfn; # remove trailing /
$dirfn = "" unless $dirfn;
$cmd_cache{"$short_cmd"} = join(',', ($path, "$dirfn$l")); # cache it