line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Siesta::Plugin::Challenge; |
2
|
3
|
|
|
3
|
|
1819
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
108
|
|
3
|
3
|
|
|
3
|
|
16
|
use Siesta::Plugin; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
19
|
|
4
|
3
|
|
|
3
|
|
76
|
use base 'Siesta::Plugin'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
269
|
|
5
|
3
|
|
|
3
|
|
840
|
use String::Random(); |
|
3
|
|
|
|
|
3289
|
|
|
3
|
|
|
|
|
689
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# suggested usage set_plugins( subscribe => qw( Challenge Subscribe ) ); |
8
|
|
|
|
|
|
|
# set_plugins( resume => qw( Resume ) ); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub description { |
11
|
1
|
|
|
1
|
0
|
430
|
'defer a message and send a challenge'; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub process { |
15
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
16
|
1
|
|
|
|
|
2
|
my $mail = shift; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
|
|
3
|
my $newmember = 0; # is this a new member |
19
|
1
|
|
|
|
|
7
|
my $member = Siesta::Member->load( $mail->from ); |
20
|
1
|
50
|
|
|
|
5
|
unless ($member) { |
21
|
0
|
|
|
|
|
0
|
my $password = String::Random->new->randpattern('......'); |
22
|
0
|
|
|
|
|
0
|
$member = Siesta::Member->create({ email => $mail->from, |
23
|
|
|
|
|
|
|
password => $password }); |
24
|
0
|
|
|
|
|
0
|
$newmember = 1; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
67
|
my $deferred = $mail->defer( who => $member, why => "challenge" ); |
28
|
1
|
|
|
|
|
44168
|
$mail->reply( |
29
|
|
|
|
|
|
|
from => $self->list->address( 'resume' ), |
30
|
|
|
|
|
|
|
body => Siesta->bake( "challenge", |
31
|
|
|
|
|
|
|
deferred => $deferred, |
32
|
|
|
|
|
|
|
newmember => $newmember, |
33
|
|
|
|
|
|
|
), |
34
|
|
|
|
|
|
|
); |
35
|
1
|
|
|
|
|
10
|
return 1; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |