]> scm.dxcluster.org Git - spider.git/blob - perl/AnnTalk.pm
added even more colouration in an attempt to make it as clear as possible
[spider.git] / perl / AnnTalk.pm
1 #
2 # Announce and Talk Handling routines
3 #
4 # Copyright (c) 2000 Dirk Koopman
5 #
6 # $Id$
7 #
8
9 package AnnTalk;
10
11 use strict;
12
13 use DXUtil;
14 use DXDebug;
15 use DXDupe;
16 use DXVars;
17
18 use vars qw(%dup $duplth $dupage $filterdef);
19
20 $duplth = 60;                                   # the length of text to use in the deduping
21 $dupage = 5*24*3600;                    # the length of time to hold spot dups
22 $filterdef = bless ([
23                           # tag, sort, field, priv, special parser 
24                           ['by', 'c', 0],
25                           ['dest', 'c', 1],
26                           ['info', 't', 2],
27                           ['group', 't', 3],
28                           ['origin', 'c', 4],
29                           ['wx', 't', 5],
30                           ['channel', 'n', 6],
31                           ['by_dxcc', 'n', 7],
32                           ['by_itu', 'n', 8],
33                           ['by_zone', 'n', 9],
34                           ['origin_dxcc', 'n', 10],
35                           ['origin_itu', 'n', 11],
36                           ['origin_itu', 'n', 12],
37                          ], 'Filter::Cmd');
38
39 use vars qw($VERSION $BRANCH);
40 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
41 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0;
42 $main::build += $VERSION;
43 $main::branch += $BRANCH;
44
45 # enter the spot for dup checking and return true if it is already a dup
46 sub dup
47 {
48         my ($call, $to, $text) = @_; 
49
50         chomp $text;
51         unpad($text);
52         $text =~ s/[\\\%]\d+//g;
53         $text =~ s/[^a-zA-Z0-9]//g;
54         $text = substr($text, 0, $duplth) if length $text > $duplth; 
55         my $dupkey = "A$to|\L$text";
56         return DXDupe::check($dupkey, $main::systime + $dupage);
57 }
58
59 sub listdups
60 {
61         return DXDupe::listdups('A', $dupage, @_);
62 }
63
64
65 1; 
66