qpsmtpd/plugins/user_config
Jared Johnson 8d032d8b50 Follow upstream convention in shebang
Our fork uses '#!/perl (Editor hint)' but upstream normally uses '#!perl'.  Conforming to upstream.

FWIW, the Kate editor recognizes the former as perl for the purpose of syntax highlighting but does not recognize the latter. But the one guy I know who uses Kate didn't take the opportunity to object :)
2014-09-15 16:53:09 -05:00

18 lines
442 B
Perl

#!perl
use strict;
use warnings;
sub hook_user_config {
my ($self,$txn,$user,$conf) = @_;
my $username = $user->host or return DECLINED;
my $filename = "/home/$username/.qpsmtpd/$conf";
return DECLINED unless -f $filename;
my $fh;
unless (open $fh,$filename) {
$self->log(LOGNOTICE,"Couldn't open $filename:$!");
return DECLINED;
}
map {chomp} (my @return = (<$fh>));
return OK,@return;
}