/usr/share/perl5/Mail/Message/Wrapper/SpamAssassin.pm is in libmail-box-perl 2.110-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | # Copyrights 2001-2014 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.01.
use strict;
use warnings;
package Mail::Message::Wrapper::SpamAssassin;
use vars '$VERSION';
$VERSION = '2.110';
use base 'Mail::SpamAssassin::Message';
use Carp;
use Mail::Message::Body;
BEGIN
{ my $v = $Mail::SpamAssassin::VERSION;
die "ERROR: spam-assassin version $v is not supported (only versions 2.x)\n"
if $v >= 3.0;
}
#------------------------------------------
sub new(@) # fix missing infra-structure of base element
{ my ($class, $message, %args) = @_;
$_->delete for $message->head->spamGroups('SpamAssassin');
$class->SUPER::new( {message => $message} )->init(\%args);
}
sub init($) { shift }
sub create_new() {croak "Should not be used"}
sub get($) { $_[0]->get_header($_[1]) }
sub get_header($)
{ my ($self, $name) = @_;
my $head = $self->get_mail_object->head;
# Return all fields unfolded in list context
return map { $_->unfoldedBody } $head->get($name)
if wantarray;
# Only one field is expected
my $field = $head->get($name);
defined $field ? $field->unfoldedBody : undef;
}
sub get_pristine_header($)
{ my ($self, $name) = @_;
my $field = $self->get_mail_object->head->get($name);
defined $field ? $field->foldedBody : undef;
}
sub put_header($$)
{ my ($self, $name, $value) = @_;
my $head = $self->get_mail_object->head;
$value =~ s/\s{2,}/ /g;
$value =~ s/\s*$//; # will cause a refold as well
return () unless length $value;
$head->add($name => $value);
}
sub get_all_headers($)
{ my $head = shift->get_mail_object->head;
"$head";
}
sub replace_header($$)
{ my $head = shift->get_mail_object->head;
my ($name, $value) = @_;
$head->set($name, $value);
}
sub delete_header($)
{ my $head = shift->get_mail_object->head;
my $name = shift;
$head->delete($name);
}
sub get_body() {shift->get_mail_object->body->lines }
sub get_pristine() { shift->get_mail_object->head->string }
sub replace_body($)
{ my ($self, $data) = @_;
my $body = Mail::Message::Body->new(data => $data);
$self->get_mail_object->storeBody($body);
}
sub replace_original_message($)
{ my ($self, $lines) = @_;
die "We will not replace the message. Use report_safe = 0\n";
}
1;
|