58964c5a67304d5ccbd46c38b32a4717083f913c
[spider.git] / perl / VE7CC.pm
1 #
2 # VE7CC variations for DXCommandmode
3 #
4 # This is done this way because a) there aren't very many and 
5 # b) because it isn't easy to reliably rebless the object in
6 # flight (as it were).
7 #
8 # This could change.
9 #
10
11 package VE7CC;
12
13 use DXVars;
14 use DXDebug;
15 use DXUtil;
16 use Julian;
17 use Prefix;
18 use DXUser;
19
20 use strict;
21
22 use vars qw($VERSION $BRANCH);
23 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
24 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/  || (0,0));
25 $main::build += $VERSION;
26 $main::branch += $BRANCH;
27
28 sub dx_spot
29 {
30         my $self = shift;                       # this may be useful some day
31         my $freq = shift;
32         my $spotted = shift;
33         my $t = shift;
34         my $loc_spotted = '';
35         my $loc_spotter = '';
36         my $ref = DXUser->get_current($spotted);
37         if ($ref) {
38                 my $loc = $ref->qra || '';
39                 $loc_spotted =substr($loc, 0, 4) if $loc;
40         }
41
42         # remove any items above the top of the max spot data
43         pop while @_ > 11;
44         
45         # make sure both US states are defined
46         $_[9] ||= '';
47         $_[10] ||= '';
48         
49         my $spotted_cc = (Prefix::cty_data($spotted))[5];
50         my $spotter_cc = (Prefix::cty_data($_[1]))[5];
51         $ref = DXUser->get_current($_[1]);
52         if ($ref) {
53                 my $loc = $ref->qra || '';
54                 $loc_spotter = substr($loc, 0, 4) if $loc;
55         }
56         
57         return sprintf("CC11^%0.1f^%s^", $freq, $spotted) . join('^', cldate($t), ztime($t), @_, $spotted_cc, $spotter_cc, $loc_spotted, $loc_spotter);
58 }
59
60 1;