line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Siesta::Plugin::SimpleSig; |
2
|
5
|
|
|
5
|
|
2719
|
use strict; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
227
|
|
3
|
5
|
|
|
5
|
|
34
|
use Siesta::Plugin; |
|
5
|
|
|
|
|
63
|
|
|
5
|
|
|
|
|
121
|
|
4
|
5
|
|
|
5
|
|
236
|
use base 'Siesta::Plugin'; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
809
|
|
5
|
5
|
|
|
5
|
|
34
|
use Siesta; |
|
5
|
|
|
|
|
19
|
|
|
5
|
|
|
|
|
61
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub description { |
8
|
1
|
|
|
1
|
0
|
476
|
'This is a very simple sig plugin, its probably more useful for testing'; |
9
|
|
|
|
|
|
|
} |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub process { |
12
|
2
|
|
|
2
|
1
|
17902
|
my $self = shift; |
13
|
2
|
|
|
|
|
9
|
my $mail = shift; |
14
|
2
|
|
|
|
|
22
|
my $list = $self->list; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
3011
|
my $maxlines = $self->pref( 'maxlines' ); |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
29
|
my ( undef, $sig ) = split /^-- $/m, $mail->body, 2; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# no point going on if there's no sig. Sob. Goodbye, cruel world. |
21
|
2
|
100
|
|
|
|
56
|
return 0 unless defined $sig; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
13
|
my (@lines) = split /\n/, $sig; |
24
|
1
|
50
|
|
|
|
10
|
if ( scalar(@lines) > $maxlines + 1 ) { |
25
|
1
|
|
|
|
|
8
|
$mail->reply( body => Siesta->bake( 'simplesig_reject', |
26
|
|
|
|
|
|
|
list => $self->list, |
27
|
|
|
|
|
|
|
maxlines => $maxlines, |
28
|
|
|
|
|
|
|
message => $mail ), |
29
|
|
|
|
|
|
|
); |
30
|
1
|
|
|
|
|
17
|
return 1; |
31
|
|
|
|
|
|
|
} |
32
|
0
|
|
|
|
|
0
|
return 0; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub options { |
36
|
|
|
|
|
|
|
+{ |
37
|
2
|
|
|
2
|
1
|
30
|
'maxlines' |
38
|
|
|
|
|
|
|
=> { |
39
|
|
|
|
|
|
|
'description' => |
40
|
|
|
|
|
|
|
'the maximum number of lines we shoudl allow in the sig before chomping', |
41
|
|
|
|
|
|
|
'type' => 'num', |
42
|
|
|
|
|
|
|
'default' => 5, |
43
|
|
|
|
|
|
|
'widget' => 'textbox', |
44
|
|
|
|
|
|
|
}, |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |