fix correct url for sh/425
[spider.git] / cmd / show / 425.pl
1 #
2 # Query the 425 Database server for a callsign
3 #
4 # from an idea by Leo,IZ5FSA and 425DxNews Group
5 #
6 #
7 #
8
9 sub handle
10 {
11         my ($self, $line) = @_;
12         my @list = map {uc} split /\s+/, $line; # generate a list of callsigns
13         my $op;
14         my $call = $self->call;
15         my @out;
16
17         return (1, $self->msg('e24')) unless $Internet::allow;
18         return (1, "SHOW/425 <callsign>\nSHOW/425 CAL\nSHOW/425 BULL <bulletin number>\n e.g. SH/425 IQ5BL, SH/425 CAL, SH/425 BUL 779\n") unless @list;
19
20         my $target = $Internet::dx425_url || 'www.iz5fsa.net';
21         my $port = 80;
22
23         dbg(join('|', @list)) if isdbg('425');
24         if ($list[0] eq "CAL") {
25                 $op="op=cal";
26         } elsif ($list[0] eq "BULL") {
27                 $op="op=bull&query=$list[1]";
28         } else {
29                 $op="op=search&query=$list[0]";
30         }
31         
32         my $path = "/425dxn/spider.php?$op";
33         
34         Log('call', "$call: show/425 \U$op");
35         my $conn = AsyncMsg->get($self, $target, $port, $path, prefix=>'425> ', 'User-Agent' => qq{DxSpider;$main::version;$main::build;$^O;$main::mycall;$call;$list[0]});
36         
37         if ($conn) {
38                 push @out, $self->msg('m21', "show/425");
39         } else {
40         push @out, $self->msg('e18', 'Open(ARI.org)');
41         }
42
43         return (1, @out);
44 }
45