5. Change the badwords interface to be the same as baddx, badspotter et al.
[spider.git] / perl / AnnTalk.pm
index 982e9c49afc9eb99b679ac180ecbdab8a48af0a4..0269edaa1e7a9ea4150fff83f9dccaf5efa65e5a 100644 (file)
@@ -27,13 +27,13 @@ $filterdef = bless ([
                          ['group', 't', 3],
                          ['origin', 'c', 4],
                          ['wx', 't', 5],
-                         ['channel', 'n', 6],
-                         ['by_dxcc', 'n', 7],
-                         ['by_itu', 'n', 8],
-                         ['by_zone', 'n', 9],
-                         ['origin_dxcc', 'n', 10],
-                         ['origin_itu', 'n', 11],
-                         ['origin_itu', 'n', 12],
+                         ['channel', 'c', 6],
+                         ['by_dxcc', 'nc', 7],
+                         ['by_itu', 'ni', 8],
+                         ['by_zone', 'nz', 9],
+                         ['origin_dxcc', 'nc', 10],
+                         ['origin_itu', 'ni', 11],
+                         ['origin_zone', 'nz', 12],
                         ], 'Filter::Cmd');
 
 use vars qw($VERSION $BRANCH);
@@ -62,6 +62,21 @@ sub listdups
        return DXDupe::listdups('A', $dupage, @_);
 }
 
-
+# is this text field a likely announce to talk substitution?
+# this may involve all sorts of language dependant heuristics, but 
+# then again, it might not
+sub is_talk_candidate
+{
+       my ($from, $text) = @_;
+       my $call;
+       ($call) = $text =~ /^\s*(?:[Xx]|[Tt][Oo]?)\s+([\w-]+)/;
+       ($call) = $text =~ /^\s*>\s*([\w-]+)\b/ unless $call;
+       ($call) = $text =~ /^\s*([\w-]+):?\b/ unless $call;
+       if ($call) {
+               $call = uc $call;
+               return is_callsign($call);
+       }
+    return undef;
+}
 1;