| 1 | package Siesta::Plugin::SimpleSig; | ||||||||||
| 2 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 6 | ▶ | use Siesta::Plugin; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | ▶ | use base 'Siesta::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 6 | ▶ | use Siesta; | ||||||||
|
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 | 'This is a very simple sig plugin, its probably more useful for testing'; | |||||||||
| 9 | } | ||||||||||
| 10 | |||||||||||
| 11 | 2 | ▶ | sub process { | ||||||||
|
Subroutine
process: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||
| 12 | 2 | my $self = shift; | |||||||||
| 13 | 2 | my $mail = shift; | |||||||||
| 14 | 2 | my $list = $self->list; | |||||||||
| 15 | |||||||||||
| 16 | 2 | my $maxlines = $self->pref( 'maxlines' ); | |||||||||
| 17 | |||||||||||
| 18 | 2 | 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 | ▶ | return 0 unless defined $sig; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | |||||||||||
| 23 | 1 | my (@lines) = split /\n/, $sig; | |||||||||
| 24 | 1 | ▶ | if ( scalar(@lines) > $maxlines + 1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 1 | $mail->reply( body => Siesta->bake( 'simplesig_reject', | |||||||||
| 26 | list => $self->list, | ||||||||||
| 27 | maxlines => $maxlines, | ||||||||||
| 28 | message => $mail ), | ||||||||||
| 29 | ); | ||||||||||
| 30 | 1 | return 1; | |||||||||
| 31 | } | ||||||||||
| 32 | 0 | return 0; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 2 | ▶ | sub options { | ||||||||
|
Subroutine
options: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 36 | +{ | ||||||||||
| 37 | 2 | '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 | 6 | 1; | |||||||||