5. Change the badwords interface to be the same as baddx, badspotter et al.
[spider.git] / perl / AnnTalk.pm
index b48dc7e0ca56f58a1bc8ed5693541cf89d6bbc93..0269edaa1e7a9ea4150fff83f9dccaf5efa65e5a 100644 (file)
@@ -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;