From 0964736afe66c066f8b77a54d77f27bdb8d24cd5 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Mon, 30 Oct 2017 15:34:21 -0400 Subject: Add get and set commands for tweaking counts. Introduce 'get' to query a count for a given email address, and 'set' to manually update it. --- bin/spamcat | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'bin/spamcat') diff --git a/bin/spamcat b/bin/spamcat index fd37f76..8549d95 100755 --- a/bin/spamcat +++ b/bin/spamcat @@ -24,6 +24,14 @@ Print a brief help message and exit. Load configuration from C +=item get C + +Show database row for C. + +=item set C C + +Set C's remaining message count to C. + =item dumpconfig Dump the current configuration. @@ -83,6 +91,16 @@ if ($#ARGV >= 0) { } print uc($k) . " = " . $v . "\n"; } + } elsif ($cmd eq 'get') { + my $sender = shift @ARGV; + pod2usage(1) unless $sender; + my $count = $sch->get_count($sender); + print "$sender has $count messages remaining.\n"; + } elsif ($cmd eq 'set') { + my ($sender, $count) = @ARGV; + pod2usage(1) unless $count && $count =~ /\d+/; + $sch->set_count($sender, $count); + print "$sender has $count messages remaining.\n"; } else { pod2usage(1); } -- cgit v1.2.3