add the H in front of the hops!!!
[spider.git] / perl / Thingy / Dx.pm
index c4d969a03aceedab799905c57c1a7b35d725fce3..596f5933abfbc3326caa2ca8dca6667c25b58ef1 100644 (file)
@@ -28,14 +28,14 @@ sub gen_Aranea
        my $thing = shift;
        unless ($thing->{Aranea}) {
                my $sd = $thing->{spotdata};
-               my @items = (
-                                        f=>$sd->[0],
-                                        c=>$sd->[1],
-                                       );
-               push @items, ('b', $sd->[4]) unless $thing->{user};
-               push @items, ('st', sprintf("%X", $sd->[2] / 60), 'o', $sd->[7]) unless $sd->[7] eq $main::mycall;
-               push @items, ('i', $sd->[3]) if $sd->[3];
-               $thing->{Aranea} = Aranea::genmsg($thing, 'DX', @items);
+               $thing->{f} = $sd->[0];
+               $thing->{c} = $sd->[1];
+               $thing->{b} = $sd->[4] unless $thing->{user};
+               my $t = int($sd->[2] / 60);
+               $thing->{t} = sprintf("%X", $t) unless $t eq int($main::systime / 60);
+               $thing->{o} =  $sd->[7] unless $sd->[7] eq $main::mycall; 
+               $thing->{i} = $sd->[3] if $sd->[3];
+               $thing->{Aranea} = Aranea::genmsg($thing, [qw(f c b t o i)]);
        }
        return $thing->{Aranea};
 }
@@ -44,16 +44,18 @@ sub from_Aranea
 {
        my $thing = shift;
        return unless $thing;
-       my $t = hex($thing->{st}) if exists $thing->{st};
-       $t ||= $thing->{time} / 60;
+       my $t = hex($thing->{t}) if exists $thing->{t};
+       $t ||= int($thing->{time} / 60);        # if it is an aranea generated
+       my $by = $thing->{b} || $thing->{fromuser} || $thing->{user} || $thing->{origin};
        my @spot = Spot::prepare(
                                                         $thing->{f},
                                                         $thing->{c},
                                                         $t*60,
                                                         ($thing->{i} || ''),
-                                                        ($thing->{b} || $thing->{fromuser} || $thing->{user} || $thing->{origin}),
+                                                        $by,
                                                         ($thing->{o} || $thing->{origin}),
                                                        );
+       $spot[4] = $by;                         # don't modify the spotter SSID
        $thing->{spotdata} = \@spot;
        return $thing;
 }
@@ -65,9 +67,9 @@ sub gen_DXProt
                my $sd = $thing->{spotdata};
                my $hops = $thing->{hops} || DXProt::get_hops(11);
                my $text = $sd->[3] || ' ';
-               $text =~ s/\^/%5E/g;
+               $text =~ s/\^/\%5E/g;
                my $t = $sd->[2];
-               $thing->{DXProt} = sprintf "PC11^%.1f^$sd->[1]^%s^%s^$text^$sd->[4]^$sd->[7]^$hops^~", $sd->[0], cldate($t), ztime($t);
+               $thing->{DXProt} = sprintf "PC11^%.1f^$sd->[1]^%s^%s^%s^$sd->[4]^$sd->[7]^H$hops^~", $sd->[0], cldate($t), ztime($t), $text;
        }
        return $thing->{DXProt};
 }
@@ -108,7 +110,7 @@ sub handle
        my $dxchan = shift;
 
        my $spot = $thing->{spotdata};
-       if (Spot::dup(@$spot[0..4])) {
+       if (Spot::dup(@$spot[0..4,5])) {
                dbg("PCPROT: Duplicate Spot ignored\n") if isdbg('chanerr');
                return;
        }