route cache, wcy, wwv. ann caching
[spider.git] / cmd / show / announce.pl
1 #
2 # print out the general log file for announces only
3 #
4 # Copyright (c) 1998 - Dirk Koopman G1TLH
5 #
6 #
7 #
8 my $self = shift;
9
10 # this appears to be a reasonable thing for users to do (thank you JE1SGH)
11 # return (1, $self->msg('e5')) if $self->priv < 9;
12
13 my $cmdline = shift;
14 my @f = split /\s+/, $cmdline;
15 my $f;
16 my @out;
17 my ($from, $to, $who); 
18
19 $from = 0;
20 while ($f = shift @f) {                 # next field
21         #  print "f: $f list: ", join(',', @list), "\n";
22         if (!$from && !$to) {
23                 ($from, $to) = $f =~ /^(\d+)-(\d+)$/o;         # is it a from -> to count?
24                 next if $from && $to > $from;
25         }
26         if (!$to) {
27                 ($to) = $f =~ /^(\d+)$/o if !$to;              # is it a to count?
28                 next if $to;
29         }
30         next if $who;
31         if ($f !~ /^\d+/) {
32                 ($who) = $f;
33         }
34         if ($f !~ /^\d+/) {
35                 ($who) = $f;
36         }
37         #($who) = $f =~ /^(\w+)/o;
38 }
39
40 $to = 20 unless $to;
41 $from = 0 unless $from;
42
43 # if we can get it out of the cache than do it
44 if (!$who && !$from && $to < @AnnTalk::anncache) {
45         my @in = @AnnTalk::anncache[-$to .. -1];
46         for (@in) {
47                 push @out, DXLog::print_item($_);
48         }
49         return (1, @out);
50 }
51
52 return (1, DXLog::print($from, $to, $main::systime, 'ann', $who)) if $self->{_nospawn} || $DB::VERSION;
53 return (1, $self->spawn_cmd("show/announce $cmdline", \&DXLog::print, args => [$from, $to, $main::systime, 'ann', $who]));
54         
55 return (1, @out);