line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: MembersOnly.pm 1348 2003-08-13 20:57:07Z richardc $ |
2
|
|
|
|
|
|
|
package Siesta::Plugin::MembersOnly; |
3
|
6
|
|
|
6
|
|
2801
|
use strict; |
|
6
|
|
|
|
|
15
|
|
|
6
|
|
|
|
|
372
|
|
4
|
6
|
|
|
6
|
|
38
|
use Siesta::Plugin; |
|
6
|
|
|
|
|
61
|
|
|
6
|
|
|
|
|
63
|
|
5
|
6
|
|
|
6
|
|
255
|
use base 'Siesta::Plugin'; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
5193
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub description { |
8
|
1
|
|
|
1
|
0
|
415
|
"reject non-member posts"; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub process { |
12
|
6
|
|
|
6
|
1
|
8626
|
my $self = shift; |
13
|
6
|
|
|
|
|
17
|
my $mail = shift; |
14
|
6
|
|
|
|
|
46
|
my $list = $self->list; |
15
|
|
|
|
|
|
|
|
16
|
6
|
100
|
|
|
|
2626
|
return if $list->is_member( $mail->from ); |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
1448
|
return if grep { |
19
|
5
|
100
|
|
|
|
8540
|
$mail->from eq $_ |
20
|
|
|
|
|
|
|
} split ' ', $self->pref('allowed_posters'); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# I'm not even supposed to be here today. |
23
|
4
|
|
|
|
|
10
|
my $extra = ''; |
24
|
4
|
100
|
|
|
|
20
|
if ($self->pref('approve')) { |
25
|
2
|
|
|
|
|
1643
|
$extra = "\nYour message is now held in an approval queue."; |
26
|
2
|
|
|
|
|
19
|
my $id = $mail->defer( |
27
|
|
|
|
|
|
|
why => "non member post requires approval", |
28
|
|
|
|
|
|
|
who => $list->owner); |
29
|
2
|
|
|
|
|
52933
|
$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
|
|
|
|
|
2663
|
$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
|
50
|
|
|
|
109
|
return 1 unless $self->pref('tell_user'); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
0
|
$mail->reply( from => $list->return_path, |
50
|
|
|
|
|
|
|
body => Siesta->bake('members_only_held', |
51
|
|
|
|
|
|
|
extra => $extra ) ); |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
0
|
return 1; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub options { |
57
|
|
|
|
|
|
|
+{ |
58
|
16
|
|
|
16
|
1
|
253
|
'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
|
|
|
|
|
|
|
1; |