| 1 | # $Id: $ | ||||||||||
| 2 | package Siesta::Plugin::Moderated; | ||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use Siesta::Plugin; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use base 'Siesta::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | ▶ | use Siesta::Deferred; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | sub description { | ||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 9 | 1 | "force all posts to be moderated by the list owner"; | |||||||||
| 10 | } | ||||||||||
| 11 | |||||||||||
| 12 | # TODO let someone who's not the owner be a moderator | ||||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | sub process { | ||||||||
|
Subroutine
process: called CC=3 SCAR=16.3
Pod
documented
| |||||||||||
| 15 | 1 | my $self = shift; | |||||||||
| 16 | 1 | my $mail = shift; | |||||||||
| 17 | 1 | my $list = $self->list; | |||||||||
| 18 | |||||||||||
| 19 | 1 | ▶ | return unless $self->pref('moderated'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | |||||||||||
| 21 | # This job would be great if it wasn't for the fucking customers. | ||||||||||
| 22 | 0 | my $id = $mail->defer( | |||||||||
| 23 | why => "moderated", | ||||||||||
| 24 | who => $list->owner, | ||||||||||
| 25 | ); | ||||||||||
| 26 | |||||||||||
| 27 | |||||||||||
| 28 | 0 | $mail->reply( to => $list->owner->email, | |||||||||
| 29 | from => $list->address('resume'), | ||||||||||
| 30 | subject => "deferred message", | ||||||||||
| 31 | body => Siesta->bake('moderated_approve', | ||||||||||
| 32 | list => $list, | ||||||||||
| 33 | mail => $mail, | ||||||||||
| 34 | deferred => $id), | ||||||||||
| 35 | ); | ||||||||||
| 36 | |||||||||||
| 37 | 0 | ▶ | return 1 unless $self->pref('tell_user'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | |||||||||||
| 39 | 0 | $mail->reply( from => $list->return_path, | |||||||||
| 40 | body => Siesta->bake('moderated') ); | ||||||||||
| 41 | |||||||||||
| 42 | 0 | return 1; | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 1 | ▶ | sub options { | ||||||||
|
Subroutine
options: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 46 | +{ | ||||||||||
| 47 | 1 | 'moderated' | |||||||||
| 48 | => { | ||||||||||
| 49 | description => "should we hold all posts to be okayed by the list-owner", | ||||||||||
| 50 | type => "boolean", | ||||||||||
| 51 | default => 0, | ||||||||||
| 52 | }, | ||||||||||
| 53 | 'tell_user' | ||||||||||
| 54 | => { | ||||||||||
| 55 | description => "should we tell the user if their post is being held?", | ||||||||||
| 56 | type => "boolean", | ||||||||||
| 57 | default => 0, | ||||||||||
| 58 | }, | ||||||||||
| 59 | }; | ||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | 3 | 1; | |||||||||