X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Ftalk.pl;h=899a44305a6a543e385e6282dbcd2f8bab85ba0e;hb=cce161221036760959ff1d0b7628a55942bf558a;hp=4002c82845e6cead2abae81d05fce91cf8e59846;hpb=69c8aeb338cc485103e289fbab7ec4e7e056ed20;p=spider.git diff --git a/cmd/talk.pl b/cmd/talk.pl index 4002c828..899a4430 100644 --- a/cmd/talk.pl +++ b/cmd/talk.pl @@ -7,35 +7,46 @@ # my ($self, $line) = @_; -my @argv = split /\s+/, $line; # generate an argv +my @argv = split /\s+/, $line; # generate an argv my $to = uc $argv[0]; my $via; my $from = $self->call(); +my @out; # have we a callsign and some text? return (1, $self->msg('e8')) if @argv < 2; if ($argv[1] eq '>') { - $via = uc $argv[2]; - $line =~ s/^$argv[0]\s+>\s+$argv[2]\s*//; + $via = uc $argv[2]; + $line =~ s/^$argv[0]\s+>\s+$argv[2]\s*//; } else { - $line =~ s/^$argv[0]\s*//; + $line =~ s/^$argv[0]\s*//; } my $call = $via ? $via : $to; my $ref = DXCluster->get($call); + +# if we haven't got an explicit via and we can't see them, try their node +unless ($ref || $via) { + my $user = DXUser->get($call); + $ref = DXCluster->get_exact($user->node); + if ($ref) { + $via = $user->node; + push @out, "trying via $via.."; + } +} return (1, "$call not visible on the cluster") if !$ref; -my $dxchan = DXCommandmode->get($to); # is it for us? +my $dxchan = DXCommandmode->get($to); # is it for us? if ($dxchan && $dxchan->is_user) { - $dxchan->send("$to de $from $line"); - Log('talk', $to, $from, $main::mycall, $line); + $dxchan->send("$to de $from $line"); + Log('talk', $to, $from, $main::mycall, $line); } else { - $line =~ s/\^//og; # remove any ^ characters - my $prot = DXProt::pc10($from, $to, $via, $line); - DXProt::route($via?$via:$to, $prot); - Log('talk', $to, $from, $via?$via:$main::mycall, $line); + $line =~ s/\^//og; # remove any ^ characters + my $prot = DXProt::pc10($from, $to, $via, $line); + DXProt::route($via?$via:$to, $prot); + Log('talk', $to, $from, $via?$via:$main::mycall, $line); } -return (1, ()); +return (1, @out);