remove shadow $i
[spider.git] / perl / DXProtout.pm
index 8de0185b10b22fb45c84b3ea3a2d11246fe71dc9..42c995510c2c265d6bf8aa52b0bbc91a4e5945a0 100644 (file)
@@ -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,6 +61,7 @@ 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^~";
 }
 
@@ -73,17 +76,17 @@ sub pc16
 {
        my $self = shift;
        my @out;
+       my $i;
 
-       foreach (@_) {
+       for ($i = 0; @_; ) {
                my $str = "PC16^$self->{call}";
-               my $i;
-    
-               for ($i = 0; @_ > 0  && $i < $DXProt::pc16_max_users; $i++) {
+               for ( ; @_ && $i < $DXProt::pc16_max_users; $i++) {
                        my $ref = shift;
                        $str .= sprintf "^%s %s %d", $ref->call, $ref->confmode ? '*' : '-', $ref->here;
                }
                $str .= sprintf "^%s^", get_hops(16);
                push @out, $str;
+               $i = 0;
        }
        return (@out);
 }
@@ -99,8 +102,7 @@ sub pc17
 # 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^";
 }
 
 #
@@ -110,12 +112,12 @@ sub pc19
 {
        my $self = shift;
        my @out;
+       my $i;
+       
 
-       while (@_) {
+       for ($i = 0; @_; ) {
                my $str = "PC19";
-               my $i;
-    
-               for ($i = 0; @_ && $i < $DXProt::pc19_max_nodes; $i++) {
+               for (; @_ && $i < $DXProt::pc19_max_nodes; $i++) {
                        my $ref = shift;
                        my $here = $ref->{here} ? '1' : '0';
                        my $confmode = $ref->{confmode} ? '1' : '0';
@@ -123,6 +125,7 @@ sub pc19
                }
                $str .= sprintf "^%s^", get_hops(19);
                push @out, $str;
+               $i = 0;
        }
        return @out;
 }