diff --git a/virtualmin-mailman-lib.pl b/virtualmin-mailman-lib.pl index 20a2efc..244dabe 100755 --- a/virtualmin-mailman-lib.pl +++ b/virtualmin-mailman-lib.pl @@ -25,6 +25,7 @@ our $mailman_var = $config{'mailman_var'} || $mailman_dir; our $newlist_cmd = "$mailman_dir/bin/newlist"; our $rmlist_cmd = "$mailman_dir/bin/rmlist"; +our $list_lists_cmd = "$mailman_dir/bin/list_lists"; our $mailman_cmd = $config{'mailman_cmd'} || "$mailman_dir/bin/mailman"; if (!-x $mailman_cmd && $config{'alt_mailman_cmd'}) { # Hack needed to handle CentOS 4 @@ -84,6 +85,15 @@ sub list_lists return @rv; } +# list_real_lists() +# Returns a list of the names of actual lists that exist in the Mailman config +sub list_real_lists +{ +my $out = &backquote_command("$list_lists_cmd -b 2>/dev/null {'list'} eq 'mailman' } @lists; if ($mailman) { - # Already exists + # Already exists and is known to Virtualmin + return 0; + } +my @real = &list_real_lists(); +if (&indexof('mailman', @real) >= 0) { + # Already exists, although not registered in Virtualmin return 0; } &foreign_require("init", "init-lib.pl");