http://bugzilla.spamassassin.org/show_bug.cgi?id=3728
Summary: SpamAssassin version 3.0.0-rc1: check_languages() never
finds the language of a message
Product: Spamassassin
Version: SVN Trunk (Latest Devel Version)
Platform: All
URL: http://www.appliedsensor.com
OS/Version: OpenBSD
Status: NEW
Severity: critical
Priority: P1
Component: Libraries
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
In Metadata::check_languages() the function TextCat::classify() is called with
my @matches = Mail::SpamAssassin::TextCat::classify($self, $body);
but $self does not include $self->{main} which is used in TextCat::classify() to
get the filename of the languages file:
TextCat::classify checks if $self->{main}->{languages_filename} is defined but
this value is always undefined since Metadata::check_languages() or
Metadata::new() doesn't set it.
Howto-Repeat:
============
*** debug output starts ***
asgwde# spamassassin -D -t < testmessage
debug: SpamAssassin version 3.0.0-rc1
debug: Score set 0 chosen.
...
debug: ---- MIME PARSER END ----
debug: decoding: quoted-printable
debug: decoding: quoted-printable
debug: Loading languages file...
debug: metadata: X-Languages:
debug: plugin: Mail::SpamAssassin::Plugin::URIDNSBL=HASH(0x3cb8a86c) implements
'parsed_metadata'
*** debug output ends ***
As you can see, X-Languages is empty. If patching Metadata.pm with the following
quick and dirty fix
**** patch start ****
--- Metadata.pm.orig Mon Jun 28 06:20:46 2004
+++ Metadata.pm Wed Aug 25 17:48:02 2004
@@ -77,16 +77,17 @@
sub extract {
my ($self, $msg, $main) = @_;
# pre-chew Received headers
$self->parse_received_headers ($main, $msg);
# and identify the language (if we're going to do that), before we
# run any Bayes tests, so they can use that as a token
+ $self->{main} = $main;
$self->check_language($main->{conf});
$main->call_plugins ("extract_metadata", { msg => $msg });
}
sub finish {
my ($self) = @_;
delete $self->{msg};
**** patch ends ****
Now the output of spamassassin with a sample Swedish mail message is
*** debug output starts ***
asgwde# spamassassin -D -t < testmessage
debug: SpamAssassin version 3.0.0-rc1
debug: Score set 0 chosen.
...
debug: ---- MIME PARSER END ----
debug: decoding: quoted-printable
debug: decoding: quoted-printable
debug: Loading languages file...
debug: Language possibly: sv,da
debug: metadata: X-Languages: sv da
*** debug output ends ***
As you can see, possible languages are found and X-Languages is now set to "sv
da".
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.