X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=cmd%2Ftalk.pl;h=827ff672d3a26210af2e95aabe8ddabc0f53a6ff;hb=7de34899527cbc4dfacdcc6452926b3d2d73792c;hp=23efabfc5e2b64999ecfe0345fe325ab013ece98;hpb=6a0068ec3df1dca0c6ae2714af3c0a4a62998dcf;p=spider.git diff --git a/cmd/talk.pl b/cmd/talk.pl index 23efabfc..827ff672 100644 --- a/cmd/talk.pl +++ b/cmd/talk.pl @@ -7,30 +7,51 @@ # 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); +my $ref = DXCluster->get_exact($call); # try an exact call +$ref = DXCluster->get($call) unless $ref; # try one ignoring SSID +$ref = DXChannel->get($call) unless $ref; # is it local? + +# 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 $user; + 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? +# change ^ into : for transmission +$line =~ s/\^/:/og; + +my $dxchan = DXCommandmode->get($to); # is it for us? if ($dxchan && $dxchan->is_user) { - $dxchan->send("$to de $from $line"); + $dxchan->send("$to de $from $line") if $dxchan->talk; + 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); + $line =~ s/\^//og; # remove any ^ characters + my $prot = DXProt::pc10($from, $to, $via, $line); + DXProt::route(undef,$via?$via:$to, $prot); + Log('talk', $to, $from, $via?$via:$main::mycall, $line); } -return (1, ()); +return (1, @out);