X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FDXProtout.pm;h=a9478812d13cb513f4541ceeffaaa15de3de074c;hb=95a03441d20680a914673d1b6bbf46c0d673ad4c;hp=8de0185b10b22fb45c84b3ea3a2d11246fe71dc9;hpb=8f391050421dd665bbf5fdcb3279a6074d97a74e;p=spider.git diff --git a/perl/DXProtout.pm b/perl/DXProtout.pm index 8de0185b..a9478812 100644 --- a/perl/DXProtout.pm +++ b/perl/DXProtout.pm @@ -37,6 +37,7 @@ sub pc10 } $text = unpad($text); $text = ' ' unless $text && length $text > 0; + $text =~ s/\^/%5E/g; return "PC10^$from^$user1^$text^*^$user2^$main::mycall^~"; } @@ -47,6 +48,7 @@ sub pc11 my $hops = get_hops(11); my $t = time; $text = ' ' if !$text; + $text =~ s/\^/%5E/g; return sprintf "PC11^%.1f^$dxcall^%s^%s^$text^$mycall^$main::mycall^$hops^~", $freq, cldate($t), ztime($t); } @@ -59,48 +61,54 @@ sub pc12 $text = ' ' if !$text; $wx = '0' if !$wx; $tonode = '*' if !$tonode; + $text =~ s/\^/%5E/g; return "PC12^$call^$tonode^$text^$sysop^$main::mycall^$wx^$hops^~"; } # # add one or more users (I am expecting references that have 'call', -# 'confmode' & 'here' method) +# 'conf' & 'here' method) # # this will create a list of PC16 with up pc16_max_users in each # called $self->pc16(..) # sub pc16 { - my $self = shift; + my $node = shift; + my $ncall = $node->call; my @out; - foreach (@_) { - my $str = "PC16^$self->{call}"; - my $i; - - for ($i = 0; @_ > 0 && $i < $DXProt::pc16_max_users; $i++) { + while (@_) { + my $str = "PC16^$ncall"; + for ( ; @_ && length $str < 200; ) { my $ref = shift; - $str .= sprintf "^%s %s %d", $ref->call, $ref->confmode ? '*' : '-', $ref->here; + $str .= sprintf "^%s %s %d", $ref->call, $ref->conf ? '*' : '-', $ref->here; } $str .= sprintf "^%s^", get_hops(16); push @out, $str; } - return (@out); + return @out; } # remove a local user sub pc17 { - my ($self, $ref) = @_; - my $hops = get_hops(17); - return "PC17^$ref->{call}^$self->{call}^$hops^"; + my @out; + while (@_) { + my $node = shift; + my $ref = shift; + my $hops = get_hops(17); + my $ncall = $node->call; + my $ucall = $ref->call; + push @out, "PC17^$ucall^$ncall^$hops^"; + } + return @out; } # Request init string sub pc18 { - my $info = DXCluster::cluster; - return "PC18^$info^$DXProt::myprot_version^"; + return "PC18^DXSpider Version: $main::version Build: $main::build^$DXProt::myprot_version^"; } # @@ -108,18 +116,17 @@ sub pc18 # sub pc19 { - my $self = shift; my @out; - while (@_) { + while(@_) { my $str = "PC19"; - my $i; - - for ($i = 0; @_ && $i < $DXProt::pc19_max_nodes; $i++) { + for (; @_ && length $str < 200;) { my $ref = shift; - my $here = $ref->{here} ? '1' : '0'; - my $confmode = $ref->{confmode} ? '1' : '0'; - $str .= "^$here^$ref->{call}^$confmode^$ref->{pcversion}"; + my $call = $ref->call; + my $here = $ref->here; + my $conf = $ref->conf; + my $version = $ref->version; + $str .= "^$here^$call^$conf^$version"; } $str .= sprintf "^%s^", get_hops(19); push @out, $str; @@ -136,10 +143,14 @@ sub pc20 # delete a node sub pc21 { - my ($call, $reason) = @_; - my $hops = get_hops(21); - $reason = "Gone." if !$reason; - return "PC21^$call^$reason^$hops^"; + my @out; + while (@_) { + my $node = shift; + my $hops = get_hops(21); + my $call = $node->call; + push @out, "PC21^$call^Gone^$hops^"; + } + return @out; } # end of init phase @@ -241,8 +252,7 @@ sub pc35 # send all the DX clusters I reckon are connected sub pc38 { - my @nodes = map { ($_->dxchan && $_->dxchan->isolate) ? () : $_->call } DXNode->get_all(); - return "PC38^" . join(',', @nodes) . "^~"; + return join '^', "PC38", map {$_->call} Route::Node::get_all(); } # tell the local node to discconnect