Mail-Decency
view release on metacpan or search on metacpan
lib/Mail/Decency/ContentFilter/CRM114.pm view on Meta::CPAN
my $status = index( $parsed{ Status }, 'spam' ) > -1
? 'spam'
: ( index( $parsed{ Status }, 'good' ) > -1
? 'good'
: 'unsure'
)
;
my @info = ( "CRM114 status: $status" );
# translate weight from crm114 to our requirements
if ( $self->has_weight_translate ) {
# extract weight
( $weight ) = $parsed{ Status } =~ /^.*?\(\s+(\-?\d+\.\d+)\s+\).*?/;
my $orig_weight = $weight;
# remember info for headers
push @info, "CRM114 score: $orig_weight";
# translate weight
$weight = $self->translate_weight( $orig_weight );
$self->logger->debug0( "Translated score from '$orig_weight' to '$weight'" );
}
elsif ( $status eq 'spam' ) {
$weight = $self->weight_spam;
$self->logger->debug0( "Use spam status, set score to '$weight'" );
}
elsif ( $status eq 'good' ) {
$weight = $self->weight_innocent;
$self->logger->debug0( "Use good status, set score to '$weight'" );
}
# add weight to content filte score
return $self->add_spam_score( $weight, \@info );
}
else {
$self->logger->error( "Could not retreive status from CRM114 result '$result'" );
}
# return ok
return ;
}
=head2 get_user_fallback
CRM114 runs normally with $USER_HOME/.crm114 .. this fallback method implements that. As long as no "cmd_user" is set, it will be used.
=cut
sub get_user_fallback {
my ( $self ) = @_;
my ( $user, $domain ) = split( /@/, $self->to, 2 );
return unless $user;
my $uid = getpwnam( $user );
return unless $uid;
$user = ( getpwuid( $uid ) )[-2];
$user .= "/.crm114";
return $user;
}
=head1 SEE ALSO
=over
=item * L<Mail::Decency::ContentFilter::Core::Cmd>
=item * L<Mail::Decency::ContentFilter::Core::Spam>
=item * L<Mail::Decency::ContentFilter::Core::WeightTranslate>
=item * L<Mail::Decency::ContentFilter::Bogofilter>
=item * L<Mail::Decency::ContentFilter::DSPAM>
=back
=head1 AUTHOR
Ulrich Kautz <uk@fortrabbit.de>
=head1 COPYRIGHT
Copyright (c) 2010 the L</AUTHOR> as listed above
=head1 LICENCSE
This library is free software and may be distributed under the same terms as perl itself.
=cut
1;
( run in 1.582 second using v1.01-cache-2.11-cpan-39bf76dae61 )