diff options
author | Brian Cully <bjc@kublai.com> | 2017-10-30 15:34:21 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2017-10-30 15:34:21 -0400 |
commit | 0964736afe66c066f8b77a54d77f27bdb8d24cd5 (patch) | |
tree | 5a39219a8f745b0a3b374e25d86c00bbde10fc77 /bin | |
parent | f887806c5989fc3e5c86107d6ff945a6fc63b05c (diff) | |
download | spamcat-0964736afe66c066f8b77a54d77f27bdb8d24cd5.tar.gz spamcat-0964736afe66c066f8b77a54d77f27bdb8d24cd5.zip |
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.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/spamcat | 18 |
1 files changed, 18 insertions, 0 deletions
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<file> +=item get C<sender> + +Show database row for C<sender>. + +=item set C<sender> C<count> + +Set C<sender>'s remaining message count to C<count>. + =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); } |