]> git.proxmox.com Git - pmg-api.git/commitdiff
MailTracker: handle before queue status
authorStoiko Ivanov <s.ivanov@proxmox.com>
Thu, 30 Apr 2020 15:01:51 +0000 (17:01 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 6 May 2020 11:57:57 +0000 (13:57 +0200)
corresponding to the patch for pmg-log-tracker, we need to translate the
before queue status to 'Accept' + the status of the relayed mail.

Reviewed-By: Mira Limbeck <m.limbeck@proxmox.com>
Tested-By: Mira Limbeck <m.limbeck@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/API2/MailTracker.pm

index 6824ba83875b01646bc7bdd9a3fd3c2b55390111..88ece6efdb5d61bb97d03165171b25439309e613 100644 (file)
@@ -131,14 +131,24 @@ my $run_pmg_log_tracker = sub {
                $new->{client} = $entry->{client} if defined($entry->{client});
                $new->{msgid} = $entry->{msgid} if defined($entry->{msgid});
                $new->{time} = hex($1) - $timezone;
-               $new->{qid} = $2;
-               $new->{dstatus} = $3;
+               $new->{dstatus} = my $dstatus = $3;
+               $new->{qid} = my $qid = $2;
                $new->{from} = $4;
-               $new->{to} = $5;
+               $new->{to} = my $to = $5;
                $new->{relay} = $6;
 
+               if ($dstatus =~ /P|D|R/) {
+                   my $before_queue_status = {
+                       P => '2',
+                       D => '4',
+                       R => '5',
+                   };
+                   $new->{dstatus} = 'A';
+                   $new->{rstatus} = $before_queue_status->{$dstatus};
+               }
+
                push @$list, $new;
-               $lookup_hash->{$2}->{$5} = $new;
+               $lookup_hash->{$qid}->{$to} = $new;
            } elsif ($line =~ m/^(SMTP|FILTER|QMGR):/) {
                if ($logids->{$entry->{qid}}) {
                    $state = 'logs';