From e8235e7264e467f6dd64587fbd26faad2f74cbbc Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Sun, 19 Jun 2022 18:46:04 -0400 Subject: Show remaining in Subject. --- lib/SpamCat.pm | 2 +- t/fixtures/foo.expected | 2 +- t/fixtures/foo2.expected | 2 +- t/fixtures/multiple.expected | 2 +- t/fixtures/nosubj.expected | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/SpamCat.pm b/lib/SpamCat.pm index 7dff474..4807149 100644 --- a/lib/SpamCat.pm +++ b/lib/SpamCat.pm @@ -48,7 +48,7 @@ sub deliver { return if $count == 0; if ($count > 0) { - my $count_str = '[' . $count . '/' . $self->{default_count} . ']'; + my $count_str = '[' . ($self->{default_count} - $count + 1) . '/' . $self->{default_count} . ']'; my $new_subject = $email->header('Subject'); if ($new_subject) { $new_subject .= ' - ' . $count_str; diff --git a/t/fixtures/foo.expected b/t/fixtures/foo.expected index 6db2a36..7516338 100644 --- a/t/fixtures/foo.expected +++ b/t/fixtures/foo.expected @@ -6,7 +6,7 @@ Received: from mta.example.com Received: by mta.example.com (Postfix, from userid 1001) id 844956F1EE; Thu, 20 Nov 2014 17:17:18 -0500 (EST) To: foo@spamcat.example.com -Subject: test - [18/20] +Subject: test - [3/20] Message-Id: Date: Thu, 20 Nov 2014 17:17:18 -0500 (EST) From: sender@example.com (Spamcat Sender) diff --git a/t/fixtures/foo2.expected b/t/fixtures/foo2.expected index da9e9ae..ed86987 100644 --- a/t/fixtures/foo2.expected +++ b/t/fixtures/foo2.expected @@ -6,7 +6,7 @@ Received: from mta.example.com Received: by mta.example.com (Postfix, from userid 1001) id 844956F1EE; Thu, 20 Nov 2014 17:17:18 -0500 (EST) To: foo@spamcat2.example.com -Subject: test - [17/20] +Subject: test - [4/20] Message-Id: Date: Thu, 20 Nov 2014 17:17:18 -0500 (EST) From: sender@example.com (Spamcat Sender) diff --git a/t/fixtures/multiple.expected b/t/fixtures/multiple.expected index 5c66e02..c867cc4 100644 --- a/t/fixtures/multiple.expected +++ b/t/fixtures/multiple.expected @@ -7,7 +7,7 @@ Received: by mta.example.com (Postfix, from userid 1001) id 844956F1EE; Thu, 20 Nov 2014 17:17:18 -0500 (EST) To: name1@spamcat.example.com, "Someone else" , foo@wrongdomain.example.com -Subject: test - [20/20] +Subject: test - [1/20] Message-Id: Date: Thu, 20 Nov 2014 17:17:18 -0500 (EST) From: sender@example.com (Spamcat Sender) diff --git a/t/fixtures/nosubj.expected b/t/fixtures/nosubj.expected index 7acd9ca..440a862 100644 --- a/t/fixtures/nosubj.expected +++ b/t/fixtures/nosubj.expected @@ -9,7 +9,7 @@ To: nosubj@spamcat.example.com Message-Id: Date: Thu, 20 Nov 2014 17:17:18 -0500 (EST) From: sender@example.com (Spamcat Sender) -Subject: [20/20] +Subject: [1/20] X-SpamCat-Remaining: 20 Sample email. -- cgit v1.2.3