aboutsummaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
authorGravatar Sadie Powell2021-10-09 18:21:18 +0100
committerGravatar Sadie Powell2021-10-09 18:21:18 +0100
commit74490ab367ebddd8fa4a6b5129ff9cb090d771b6 (patch)
treef71613695ca258352219b433b5eaba51b16e75e5 /make
parentThe opmoderated module should have the VF_VENDOR property. (diff)
ALlow specifying multiple ModAuthors, remove ModAuthorMail.
Diffstat (limited to 'make')
-rw-r--r--make/directive.pm37
1 files changed, 21 insertions, 16 deletions
diff --git a/make/directive.pm b/make/directive.pm
index 6368168c0..304f42384 100644
--- a/make/directive.pm
+++ b/make/directive.pm
@@ -33,24 +33,32 @@ use make::console;
use constant DIRECTIVE_ERROR_PIPE => $ENV{INSPIRCD_VERBOSE} ? '' : '2>/dev/null';
use constant VENDOR_DIRECTORY => catdir(dirname(dirname(__FILE__)), 'vendor');
-our @EXPORT = qw(get_directive
- execute_functions);
+our @EXPORT = qw(
+ get_directives
+ get_directive
+ execute_functions
+);
-sub get_directive($$;$)
-{
- my ($file, $property, $default) = @_;
- open(my $fh, $file) or return $default;
+sub get_directives($$) {
+ my ($file, $property) = @_;
+ open(my $fh, $file) or return ();
- my $value = '';
+ my @values;
while (<$fh>) {
if ($_ =~ /^\/\* \$(\S+): (.+) \*\/$/ || $_ =~ /^\/\/\/ \$(\S+): (.+)/) {
next unless $1 eq $property;
- $value .= ' ' . execute_functions($file, $1, $2);
+ push @values, execute_functions($file, $1, $2);
}
}
close $fh;
+ return @values;
+}
+
+sub get_directive($$;$) {
+ my ($file, $property, $default) = @_;
+ my @values = get_directives($file, $property);
- # Strip all extraneous whitespace.
+ my $value = join ' ', @values;
$value =~ s/^\s+|\s+$//g;
return $value || $default;
}
@@ -107,14 +115,11 @@ sub __error {
# If we have author information then tell the user to report the bug
# to them. Otherwise, assume it is a bundled module and tell the user
# to report it to the InspIRCd issue tracker.
- my $author = get_directive($file, 'ModAuthor');
- if (defined $author) {
+ my @authors = get_directives($file, 'ModAuthor');
+ if (@authors) {
push @message, 'If you believe this error to be a bug then you can try to contact the';
- push @message, 'author of this module:';
- my $author_mail = get_directive($file, 'ModAuthorMail');
- if (defined $author_mail) {
- push @message, " * $author <$author_mail>";
- } else {
+ push @message, "author${$#authors ? \'s' : \''} of this module:";
+ for my $author (@authors) {
push @message, " * $author";
}
} else {