#!/usr/local/bin/perl

# If located in a lib path, this module will be loaded and called by ASSP before sending BlockReports.
# ASSP will call the sub modify of this module.
# The complete BlockReport mail will be in 'shift' or $_[0]. The module has to return the new contents.

package BlockReport::modify;
use strict;
use re 'eval';

sub modify {
    my $bl = shift;

    my %toReplace = (       # define what is to be replaced
#                     &makeRe('powered by ASSP') =>  'Powered by Synergy',
#                     &makeRe("request ASSP on $main::myName to resend") =>  'Request Synergy Spam Filtering to resend',
);

    while (my ($k,$v) = each %toReplace) {
        $bl =~ s/$k/$v=\n/g;
    }

    return $bl;
}

sub makeRe {
    my $string = shift;
    my $le = "(?:[=]\n)?";   # HTML line end
    $string =~ s/(.)/$1$le/go;  # a HTML line end could follow any character
    $string =~ s/\Q$le\E$//o;
    return qr/$string/;
}

1; # keep this !
