aboutsummaryrefslogtreecommitdiff
path: root/lib/Sietima/Role/SubscriberOnly/Moderate.pm
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2016-12-27 15:27:23 +0000
committerdakkar <dakkar@thenautilus.net>2016-12-27 15:30:09 +0000
commit2362fc13b8e79618e285d9cd1817819381d7d0a4 (patch)
tree9b70332a18ecb111905529d9e07f397c2256d0f2 /lib/Sietima/Role/SubscriberOnly/Moderate.pm
parentupdate dependencies (diff)
downloadSietima-2362fc13b8e79618e285d9cd1817819381d7d0a4.tar.gz
Sietima-2362fc13b8e79618e285d9cd1817819381d7d0a4.tar.bz2
Sietima-2362fc13b8e79618e285d9cd1817819381d7d0a4.zip
command line handling
Diffstat (limited to 'lib/Sietima/Role/SubscriberOnly/Moderate.pm')
-rw-r--r--lib/Sietima/Role/SubscriberOnly/Moderate.pm36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/Sietima/Role/SubscriberOnly/Moderate.pm b/lib/Sietima/Role/SubscriberOnly/Moderate.pm
index 0d9fd58..8f49bed 100644
--- a/lib/Sietima/Role/SubscriberOnly/Moderate.pm
+++ b/lib/Sietima/Role/SubscriberOnly/Moderate.pm
@@ -31,4 +31,40 @@ sub resume ($self,$mail_id) {
$self->mail_store->remove($mail_id);
}
+sub drop ($self,$mail_id) {
+ $self->mail_store->remove($mail_id);
+}
+
+around command_line_spec => sub ($orig,$self) {
+ my $spec = $self->$orig();
+ $spec->{subcommands}{'resume-held'} = {
+ op => sub ($self,$runner,$args) {
+ $self->resume($runner->parameters->{'mail-id'});
+ },
+ summary => 'resume the given mail, currently held for moderation',
+ parameters => [
+ {
+ name => 'mail-id',
+ required => 1,
+ summary => 'id of the mail to resume',
+ },
+ ],
+ };
+ $spec->{subcommands}{'drop-held'} = {
+ op => sub ($self,$runner,$args) {
+ $self->drop($runner->parameters->{'mail-id'});
+ },
+ summary => 'drop the given mail, currently held for moderation',
+ parameters => [
+ {
+ name => 'mail-id',
+ required => 1,
+ summary => 'id of the mail to drop',
+ },
+ ],
+ };
+
+ return $spec;
+};
+
1;