summaryrefslogtreecommitdiff
path: root/lib/JWebmail.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/JWebmail.pm')
-rw-r--r--lib/JWebmail.pm20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/JWebmail.pm b/lib/JWebmail.pm
index 993ad59..b829191 100644
--- a/lib/JWebmail.pm
+++ b/lib/JWebmail.pm
@@ -4,11 +4,10 @@ use Mojo::Base Mojolicious;
use Module::Load 'load';
+use JWebmail::Config 'LOGIN_SCHEME';
use JWebmail::Controller::Webmail;
-use JWebmail::Model::ReadMails::Role;
use JWebmail::Model::ReadMails::QMailAuthuser;
use JWebmail::Model::WriteMails;
-use JWebmail::Config qw'LOGIN_SCHEME MAILDIR_READER';
sub validateConf {
@@ -26,6 +25,9 @@ sub validateConf {
getpwnam $conf->{model}{read}{virtual_user} or die;
exists $conf->{model}{read}{mailbox_path} or die;
-d $conf->{model}{read}{mailbox_path} or die;
+ exists $conf->{model}{read}{authenticator} or die;
+
+ exists $conf->{model}{write}{sendmail} or die;
return 1;
}
@@ -42,7 +44,7 @@ sub startup {
$self->plugin('TOMLConfig');
$self->validateConf;
- if (fc LOGIN_SCHEME eq fc 's3d') {
+ if (fc LOGIN_SCHEME eq fc 'plain') {
$self->plugin('ServerSideSessionData');
}
$self->plugin('Paginate');
@@ -52,15 +54,11 @@ sub startup {
delete $self->config->{secret};
# initialize models
- my $read_mails = do {
- my $cls = MAILDIR_READER;
- eval { load $cls; 1 } || die "Issue for module $cls with: $@";
- $cls->new(($self->config->{model}{read} // {})->%*)
- };
- die "given class @{[ ref $read_mails ]} does not ReadMails"
- unless $read_mails->DOES('JWebmail::Model::ReadMails::Role');
+ my $read_mails = JWebmail::Model::ReadMails::QMailAuthuser->new($self->config->{model}{read});
$self->helper(users => sub { $read_mails });
- $self->helper(send_mail => sub { my ($c, $mail) = @_; JWebmail::Model::WriteMails::sendmail($mail) });
+
+ my $write = JWebmail::Model::WriteMails->new($self->config->{model}{write});
+ $self->helper(send_mail => sub { $write->sendmail($_[1]) });
$self->validator->add_check(mail_line => \&_mail_line);
$self->validator->add_filter(non_empty_ul => \&_filter_empty_upload);