[pmg-devel] [PATCH pmg-api v2 1/1] MailTracker: handle before queue status

Thomas Lamprecht t.lamprecht at proxmox.com
Wed May 13 13:50:24 CEST 2020


On 4/30/20 5:01 PM, Stoiko Ivanov wrote:
> 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 at proxmox.com>
> Tested-By: Mira Limbeck <m.limbeck at proxmox.com>
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
>  src/PMG/API2/MailTracker.pm | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/src/PMG/API2/MailTracker.pm b/src/PMG/API2/MailTracker.pm
> index 6824ba8..88ece6e 100644
> --- a/src/PMG/API2/MailTracker.pm
> +++ b/src/PMG/API2/MailTracker.pm
> @@ -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;

I don't like above at all, seems like a reason to adapt the perl style
guide, actually ^^ I dropped that for now.

>  		$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';
> 




More information about the pmg-devel mailing list