Match TLHs correctly, not only partially.
authorThomas Hochstein <thh@inter.net>
Sun, 27 May 2012 11:58:32 +0000 (13:58 +0200)
committerThomas Hochstein <thh@inter.net>
Fri, 12 Oct 2012 22:51:40 +0000 (00:51 +0200)
The TLH was checked to match the beginning
of the newsgroup name, not the whole TLH part.
So the TLH "de" would match not only "de.test",
but also "denver.test", which was not the
desired outcome.

Signed-off-by: Thomas Hochstein <thh@inter.net>
gatherstats.pl

index d2d4faa..6e41485 100755 (executable)
@@ -85,9 +85,15 @@ if ($Conf{'TLH'}) {
   }
   # strip whitespace
   $TLH =~ s/\s//g;
+  # add trailing dots if none are present yet
+  # (using negative look-behind assertions)
+  $TLH =~ s/(?<!\.):/.:/g;
+  $TLH =~ s/(?<!\.)$/./;
   # check for illegal characters
   &Bleat(2,'Config error - illegal characters in TLH definition!')
     if ($TLH !~ /^[a-zA-Z0-9:]+$/);
+  # escape dots
+  $TLH =~ s/\./\\./g;
   if ($TLH =~ /:/) {
     # reformat $TLH from a:b to (a)|(b),
     # e.g. replace ':' by ')|('
This page took 0.010367 seconds and 4 git commands to generate.