From 3da1e1c91effff02857badfe3a472a49aba9d60d Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Sun, 19 Jun 2022 20:12:04 -0400 Subject: Fix off-by-one error in subject and remaining count header. --- lib/SpamCat.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/SpamCat.pm b/lib/SpamCat.pm index cbae3fd..282ac7c 100644 --- a/lib/SpamCat.pm +++ b/lib/SpamCat.pm @@ -48,7 +48,7 @@ sub filter { # Negative counts indicate unlimited delivery. # if (defined $count && $count >= 0) { - my $count_str = '[' . ($self->{default_count} - $count + 1) . '/' . $self->{default_count} . ']'; + my $count_str = '[' . ($self->{default_count} - $count) . '/' . $self->{default_count} . ']'; my $new_subject = $email->header('Subject'); if ($new_subject) { $new_subject .= ' - ' . $count_str; @@ -158,7 +158,7 @@ sub decrement_count_t { my $q; my $count = $self->get_count_t($sender); if (!defined $count) { - $count = $self->{default_count}; + $count = $self->{default_count} - 1; $q = 'INSERT INTO emails (count, sender) VALUES (?, ?)'; } elsif ($count <= 0) { return $count; -- cgit v1.2.3