diff --git a/Debbugs/User.pm b/Debbugs/User.pm index 9f64be3f..86e60b19 100644 --- a/Debbugs/User.pm +++ b/Debbugs/User.pm @@ -105,10 +105,36 @@ BEGIN { ####################################################################### # Helper functions +our $_lists; +sub is_valid_package { + my $p = shift; + + unless ($_lists) { + my $file = "$config{config_dir}/Lists"; + my %lists; + my $pkg; + + open(FILE,"<$file" ) || die "$file open: $!"; + + while() { + + next unless m/^(\S+)\s+(\S.*\S)\s*$/; + $pkg = $1; + $pkg =~ y/A-Z/a-z/; + $lists{$pkg}++; + } + + close(FILE); + + $_lists = \%lists; + } + + return ${$_lists}{$p}; +} + sub is_valid_user { my $u = shift; - return ($u =~ /^[a-zA-Z0-9._+-]+[@]?[a-zA-Z0-9-.]{4,}$/); -# return ($u =~ /^[a-zA-Z0-9._+-]+[@][a-z0-9-.]{4,}$/); + return ($u =~ /^[a-zA-Z0-9._+-]+[@][a-z0-9-.]{4,}$/) || (is_valid_package($u)); } #######################################################################