diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-02-26 21:36:27 +0100 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-02-26 21:36:27 +0100 |
commit | 2abf462ca10c4ac8c4f815e608cad31851e966e3 (patch) | |
tree | ed18c4a4039a5972edc0b81ed79c9d57480f8e70 /lib/JWebmail/Controller | |
parent | d0ffe11bd365b68d4da252b39d06d99f75d8cacb (diff) |
Specified the interface for qmauth
Changes to configuration
Added qmauth version written in Python
Slight changes to pagination
Diffstat (limited to 'lib/JWebmail/Controller')
-rw-r--r-- | lib/JWebmail/Controller/Webmail.pm | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/JWebmail/Controller/Webmail.pm b/lib/JWebmail/Controller/Webmail.pm index b094a43..2f71021 100644 --- a/lib/JWebmail/Controller/Webmail.pm +++ b/lib/JWebmail/Controller/Webmail.pm @@ -7,7 +7,7 @@ use List::Util 'first'; use Mojolicious::Types; use constant { - S_USER => 'user', # Key for user name in active session + S_USER => 'user', # Key for user name in active session ST_AUTH => 'auth', }; @@ -134,7 +134,7 @@ sub displayheaders { my $folders = _time { $self->users->folders($auth) } $self, 'user folders'; - unless ( $self->stash('folder') ~~ $folders ) { + unless ( !$self->stash('folder') || $self->stash('folder') ~~ $folders ) { $self->render(template => 'error', status => 404, error => $self->l('no_folder'), @@ -153,9 +153,9 @@ sub displayheaders { return; } - my ($total_byte_size, $cnt, $new) = _time { $self->users->count($auth, $self->stash('folder')) } $self, 'user count'; + my $count = _time { $self->users->count($auth, $self->stash('folder')) } $self, 'user count'; - my ($start, $end) = $self->paginate($cnt); + my ($start, $end) = $self->paginate($count->{total_mails}); $self->timing->begin('user_headers'); my $headers = do { @@ -178,10 +178,10 @@ sub displayheaders { $self->app->log->debug(sprintf("Reading user headers took %fs", $elapsed)); $self->stash( - msgs => $headers, - mail_folders => $folders, - total_size => $total_byte_size, - total_new_mails => $new, + msgs => $headers, + mail_folders => $folders, + total_size => $count->{byte_size}, + total_new_mails => $count->{unread_mails}, ); } @@ -194,7 +194,7 @@ sub readmail { my $auth = $self->stash(ST_AUTH); my $mail; - my $ok = eval { $mail = $self->users->show($auth, $mid); 1 }; + my $ok = eval { $mail = $self->users->show($auth, '', $mid); 1 }; if (!$ok) { my $err = $@; if ($err =~ m/unkown mail-id|no such message/) { @@ -210,11 +210,11 @@ sub readmail { return if $v->has_error; if ($type) { - if ($mail->{head}{content_type} =~ '^multipart/') { - my $content = first {$_->{head}{content_type} =~ $type} @{ $mail->{body} }; + if ($mail->{head}{mime}{content_maintype} eq 'multipart') { + my $content = first {$_->{head}{mime}{content_subtype} eq $type} @{ $mail->{body} }; $self->render(text => $content->{body}); } - elsif ($mail->{head}{content_type} =~ $type) { + elsif ($mail->{head}{mime}{content_subtype} eq $type) { $self->render(text => $mail->{body}) ; } else { @@ -297,7 +297,7 @@ sub move { no warnings 'experimental::smartmatch'; die "$folder not valid" unless $folder ~~ $folders; - $self->users->move($auth, $_, $folder) for @$mm; + $self->users->move($auth, $_, '', $folder) for @$mm; $self->flash(message => $self->l('succ_move')); $self->res->code(303); |