add ip addresses to dxspots emitted as PC61
[spider.git] / perl / DXProtout.pm
index 8c5e56d9abe3cdf5da625734b33670350bbc189b..ba3013389b8f13b26dc6acf7f900621734498e9c 100644 (file)
@@ -11,7 +11,7 @@
 
 package DXProt;
 
-@ISA = qw(DXProt DXChannel);
+@ISA = qw(DXChannel);
 
 use DXUtil;
 use DXM;
@@ -47,7 +47,7 @@ sub pc10
        return "PC10^$from^$user1^$text^*^$user2^$origin^~";
 }
 
-# create a dx message (call, freq, dxcall, text)
+# create a dx message (call, freq, dxcall, text) see also pc61
 sub pc11
 {
        my ($mycall, $freq, $dxcall, $text) = @_;
@@ -58,6 +58,17 @@ sub pc11
        return sprintf "PC11^%.1f^$dxcall^%s^%s^$text^$mycall^$main::mycall^$hops^~", $freq, cldate($t), ztime($t);
 }
 
+# create a dx message (call, freq, dxcall, text, $ipaddr) see also pc11
+sub pc61
+{
+       my ($mycall, $freq, $dxcall, $text, $ipaddr) = @_;
+       my $hops = get_hops(61) || get_hops(11);
+       my $t = time;
+       $text = ' ' if !$text;
+       $text =~ s/\^/%5E/g;
+       return sprintf "PC61^%.1f^$dxcall^%s^%s^$text^$mycall^$main::mycall^$ipaddr^$hops^~", $freq, cldate($t), ztime($t);
+}
+
 # create an announce message
 sub pc12
 {
@@ -385,7 +396,7 @@ sub _gen_pc92
        }
        for (@_) {
                $s .= '^' . _encode_pc92_call($_, $ext);
-               $ext = 0;                               # only the first slot has an ext.
+               $ext = 0 unless $sort eq 'A';                           # only the first slot has an ext.
        }
        return $s . '^H99^';
 }
@@ -410,7 +421,7 @@ sub gen_pc92_with_time
 # add a local one
 sub pc92a
 {
-       return _gen_pc92('A', 0, @_);
+       return _gen_pc92('A', 2, @_);
 }
 
 # delete a local one
@@ -422,7 +433,7 @@ sub pc92d
 # send a config
 sub pc92c
 {
-       return _gen_pc92('C', 0, @_);
+       return _gen_pc92('C', 1, @_);
 }
 
 # send a keep alive