| 1 | # $Id: MembersOnly.pm 1348 2003-08-13 20:57:07Z richardc $ | ||||||||||
| 2 | package Siesta::Plugin::MembersOnly; | ||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 7 | ▶ | use Siesta::Plugin; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 7 | ▶ | use base 'Siesta::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | sub description { | ||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 8 | 1 | "reject non-member posts"; | |||||||||
| 9 | } | ||||||||||
| 10 | |||||||||||
| 11 | 6 | ▶ | sub process { | ||||||||
|
Subroutine
process: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||
| 12 | 6 | my $self = shift; | |||||||||
| 13 | 6 | my $mail = shift; | |||||||||
| 14 | 6 | my $list = $self->list; | |||||||||
| 15 | |||||||||||
| 16 | 6 | ▶ | return if $list->is_member( $mail->from ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | |||||||||||
| 18 | return if grep { | ||||||||||
| 19 | 5 | ▶ | $mail->from eq $_ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | } split ' ', $self->pref('allowed_posters'); | ||||||||||
| 21 | |||||||||||
| 22 | # I'm not even supposed to be here today. | ||||||||||
| 23 | 4 | my $extra = ''; | |||||||||
| 24 | 4 | ▶ | if ($self->pref('approve')) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 2 | $extra = "\nYour message is now held in an approval queue."; | |||||||||
| 26 | 2 | my $id = $mail->defer( | |||||||||
| 27 | why => "non member post requires approval", | ||||||||||
| 28 | who => $list->owner); | ||||||||||
| 29 | 2 | $mail->reply( to => $list->owner->email, | |||||||||
| 30 | from => $list->address('resume'), | ||||||||||
| 31 | subject => "deferred message", | ||||||||||
| 32 | body => Siesta->bake('members_only_approve', | ||||||||||
| 33 | list => $list, | ||||||||||
| 34 | mail => $mail, | ||||||||||
| 35 | deferred => $id), | ||||||||||
| 36 | ); | ||||||||||
| 37 | } | ||||||||||
| 38 | else { | ||||||||||
| 39 | 2 | $mail->reply( to => $list->owner->email, | |||||||||
| 40 | from => $list->return_path, | ||||||||||
| 41 | body => Siesta->bake('members_only_dropped', | ||||||||||
| 42 | list => $list, | ||||||||||
| 43 | mail => $mail) | ||||||||||
| 44 | ); | ||||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 4 | ▶ | return 1 unless $self->pref('tell_user'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | |||||||||||
| 49 | 0 | $mail->reply( from => $list->return_path, | |||||||||
| 50 | body => Siesta->bake('members_only_held', | ||||||||||
| 51 | extra => $extra ) ); | ||||||||||
| 52 | |||||||||||
| 53 | 0 | return 1; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 16 | ▶ | sub options { | ||||||||
|
Subroutine
options: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 57 | +{ | ||||||||||
| 58 | 16 | 'approve' | |||||||||
| 59 | => { | ||||||||||
| 60 | description => "should we hold non-member posts for approval", | ||||||||||
| 61 | type => "boolean", | ||||||||||
| 62 | default => 1, | ||||||||||
| 63 | }, | ||||||||||
| 64 | 'tell_user' | ||||||||||
| 65 | => { | ||||||||||
| 66 | description => "should we tell the user if their post is rejected/delayed", | ||||||||||
| 67 | type => "boolean", | ||||||||||
| 68 | default => 0, | ||||||||||
| 69 | }, | ||||||||||
| 70 | 'allowed_posters' | ||||||||||
| 71 | => { | ||||||||||
| 72 | description => "people allowed to post who aren't on the system", | ||||||||||
| 73 | type => "string", | ||||||||||
| 74 | default => "", | ||||||||||
| 75 | }, | ||||||||||
| 76 | }; | ||||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | 7 | 1; | |||||||||