aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2022-06-19 20:12:04 -0400
committerBrian Cully <bjc@kublai.com>2022-06-19 20:12:04 -0400
commit3da1e1c91effff02857badfe3a472a49aba9d60d (patch)
tree6514d42e41cdcdcf362c63b373e727dec5c2f628 /lib
parentf2820a509d91061b65fa32ec4e647cbd29760195 (diff)
downloadspamcat-3da1e1c91effff02857badfe3a472a49aba9d60d.tar.gz
spamcat-3da1e1c91effff02857badfe3a472a49aba9d60d.zip
Fix off-by-one error in subject and remaining count header.
Diffstat (limited to 'lib')
-rw-r--r--lib/SpamCat.pm4
1 files changed, 2 insertions, 2 deletions
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;