X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXCommandmode.pm;h=798351773c998c62f603facd84c093c782873d34;hb=c02dc2d8b544b9d682c9a068ba13bdedf40ed3bf;hp=cdde9a20b99e512247f6d4fd837ff44050bf8b05;hpb=82aac01bdf511916e98a71873950fb98a54440a0;p=spider.git diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index cdde9a20..79835177 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -65,7 +65,7 @@ sub new my $pkg = shift; my $call = shift; # my @rout = $main::routeroot->add_user($call, Route::here(1)); - DXProt::_add_thingy($main::routeroot, [$call, 0, 0, 1]); + DXProt::_add_thingy($main::routeroot, [$call, 0, 0, 1, undef, undef, $self->{conn}->peerhost], ); # ALWAYS output the user my $ref = Route::User::get($call); @@ -89,7 +89,7 @@ sub start my $name = $user->{name}; # log it - my $host = $self->{conn}->{peerhost}; + my $host = $self->{conn}->peerhost; $host ||= "AGW Port #$self->{conn}->{agwport}" if exists $self->{conn}->{agwport}; $host ||= "unknown"; LogDbg('DXCommand', "$call connected from $host"); @@ -133,23 +133,8 @@ sub start $self->{registered} = 1; } - - # decide which motd to send - my $motd; - unless ($self->{registered}) { - $motd = "${main::motd}_nor_$self->{lang}"; - $motd = "${main::motd}_nor" unless -e $motd; - } - $motd = "${main::motd}_$self->{lang}" unless $motd && -e $motd; - $motd = $main::motd unless $motd && -e $motd; - if ($self->conn->{csort} eq 'ax25') { - if ($motd) { - $motd = "${motd}_ax25" if -e "${motd}_ax25"; - } else { - $motd = "${main::motd}_ax25" if -e "${main::motd}_ax25"; - } - } - $self->send_file($motd) if -e $motd; + # send the relevant MOTD + $self->send_motd; # sort out privilege reduction $self->{priv} = 0 if $line =~ /^(ax|te)/ && !$self->conn->{usedpasswd}; @@ -218,7 +203,7 @@ sub start foreach my $call (@{$user->buddies}) { my $ref = Route::User::get($call); if ($ref) { - foreach my $node (@{$ref->parent}) { + foreach my $node ($ref->parents) { $self->send($self->msg($node eq $main::mycall ? 'loginb' : 'loginbn', $call, $node)); } } @@ -971,7 +956,7 @@ sub format_dx_spot my $comment = substr (($_[3] || ''), 0, $clth); $comment .= ' ' x ($clth - length($comment)); if ($self->{user}->wantgrid) { - my $ref = DXUser->get_current($_[4]); + my $ref = DXUser::get_current($_[4]); if ($ref) { $loc = $ref->qra || ''; $loc = ' ' . substr($loc, 0, 4) if $loc; @@ -1015,7 +1000,7 @@ sub dx_spot } elsif ($self->{gtk}) { my ($dxloc, $byloc); - my $ref = DXUser->get_current($_[4]); + my $ref = DXUser::get_current($_[4]); if ($ref) { $byloc = $ref->qra; $byloc = substr($byloc, 0, 4) if $byloc; @@ -1023,7 +1008,7 @@ sub dx_spot my $spot = $_[1]; $spot =~ s|/\w{1,4}$||; - $ref = DXUser->get_current($spot); + $ref = DXUser::get_current($spot); if ($ref) { $dxloc = $ref->qra; $dxloc = substr($dxloc, 0, 4) if $dxloc; @@ -1191,7 +1176,7 @@ sub import_cmd if ($dxchan) { @out = $s->run($dxchan, 1); } else { - my $u = DXUser->get($call); + my $u = DXUser::get($call); if ($u) { $dxchan = $main::me; my $old = $dxchan->{call}; @@ -1226,5 +1211,27 @@ sub print_find_reply my $sort = $flag == 2 ? "External" : "Local"; $self->send("$sort $target found at $node in $ms ms" ); } + +# send the most relevant motd +sub send_motd +{ + my $self = shift; + my $motd; + + unless ($self->{registered}) { + $motd = "${main::motd}_nor_$self->{lang}"; + $motd = "${main::motd}_nor" unless -e $motd; + } + $motd = "${main::motd}_$self->{lang}" unless $motd && -e $motd; + $motd = $main::motd unless $motd && -e $motd; + if ($self->conn->ax25) { + if ($motd) { + $motd = "${motd}_ax25" if -e "${motd}_ax25"; + } else { + $motd = "${main::motd}_ax25" if -e "${main::motd}_ax25"; + } + } + $self->send_file($motd) if -e $motd; +} 1; __END__