]> git.proxmox.com Git - pmg-api.git/commitdiff
MailQueue: return maximum AID
authorDominik Csapak <d.csapak@proxmox.com>
Wed, 21 Feb 2024 12:24:33 +0000 (13:24 +0100)
committerStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 21 Feb 2024 18:30:13 +0000 (19:30 +0100)
we'll need this in the what_matches to invert mark lists.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PMG/MailQueue.pm
src/PMG/Utils.pm
src/bin/pmg-smtp-filter

index 8355c303a42570036fd4a3936257e6a488c35873..4e37cb989fdbf86a44466914d5f6e25a756f5a90 100644 (file)
@@ -406,10 +406,10 @@ sub parse_mail {
     # we also remove all proxmox-marks from the mail and add an unique
     # id to each attachment.
 
-    PMG::Utils::remove_marks ($entity, 1);
+    my $max_aid = PMG::Utils::remove_marks ($entity, 1);
     PMG::Utils::add_ct_marks ($entity);
 
-    return $entity;
+    return ($entity, $max_aid);
 }
 
 sub decode_entities {
index 12b3ed5adeece6fd5bc75575c092848e79f4e871..afccaf4ce381a45859e586bfc4210aab1d9a6826 100644 (file)
@@ -185,6 +185,8 @@ sub remove_marks {
 
        $id++;
     });
+
+    return $id - 1; # return max AID
 }
 
 sub subst_values {
index 862961dc23c78de6a4984734b756501a41218c5f..385e8daa432b492b349d63b4b09140f0ccdb0652 100755 (executable)
@@ -659,7 +659,8 @@ sub handle_smtp {
 
        my $maxfiles = $pmg_cfg->get('clamav', 'archivemaxfiles');
 
-       my $entity = $queue->parse_mail($maxfiles);
+       my ($entity, $max_aid) = $queue->parse_mail($maxfiles);
+       $msginfo->{max_aid} = $max_aid;
 
        $self->log (3, "$queue->{logid}: new mail message-id=%s", $queue->{msgid});