| 1 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | package Siesta::Plugin::Resume; | ||||||||||
| 3 | 3 | ▶ | use base 'Siesta::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use Digest::MD5 qw(md5_hex); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | sub description { "set a deferred message on its way" } | ||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | sub process { | ||||||||
|
Subroutine
process: called CC=5 SCAR=28.5
Pod
documented
| |||||||||||
| 8 | 1 | my $self = shift; | |||||||||
| 9 | 1 | my $mail = shift; | |||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | return unless $mail->body =~ /resume (\d+) (\S+)/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | 0 | my ($id, $hash) = ($1, $2); | |||||||||
| 13 | |||||||||||
| 14 | 0 | ▶ | my $deferred = Siesta::Deferred->retrieve( $id ) or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 0 | ▶ | unless ($deferred->who->email eq $mail->from) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | # you don't own this message, so you can't resume it | ||||||||||
| 17 | 0 | return 1; | |||||||||
| 18 | } | ||||||||||
| 19 | 0 | ▶ | unless ( $deferred->hash eq $hash ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | # wrong magic cookie | ||||||||||
| 21 | 0 | return 1; | |||||||||
| 22 | } | ||||||||||
| 23 | 0 | $deferred->resume; | |||||||||
| 24 | 0 | return 1; | |||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 3 | 1; | |||||||||