/[smecontribs]/rpms/smeserver-learn/contribs10/smeserver-learn-1.0-SME9282.patch
ViewVC logotype

Contents of /rpms/smeserver-learn/contribs10/smeserver-learn-1.0-SME9282.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sun Dec 20 11:47:13 2020 UTC (3 years, 11 months ago) by brianr
Branch: MAIN
CVS Tags: smeserver-learn-1_0-15_el7_sme, smeserver-learn-1_0-16_el7_sme, smeserver-learn-1_0-14_el7_sme, HEAD
Initial import

1 diff -up smeserver-learn-1.0/root/usr/bin/Learn.pl.SME9282 smeserver-learn-1.0/root/usr/bin/Learn.pl
2 --- smeserver-learn-1.0/root/usr/bin/Learn.pl.SME9282 2016-03-16 07:38:34.092000000 -0400
3 +++ smeserver-learn-1.0/root/usr/bin/Learn.pl 2016-03-16 07:32:47.000000000 -0400
4 @@ -22,6 +22,8 @@ use File::Find;
5 use File::Copy;
6 use File::Basename;
7 use File::Path;
8 +use Encode qw/encode decode/;
9 +use utf8;
10
11 my $hostname = hostname();
12
13 @@ -32,7 +34,8 @@ my $sadb = esmith::ConfigDB->open_ro()
14 or die "Could not open ConfigurationDB ( reason : ".esmith::DB->error." )\n";
15
16 # some variables of interest
17 -my $subjectTAG=quotemeta $sadb->get_prop("spamassassin", "Subject");
18 +my $subjectTAG= $sadb->get_prop("spamassassin", "Subject");
19 +my $tag= $sadb->get_prop("LearnAsSpam", "tag");
20 my $MessageRetentionTime = $sadb->get_prop('spamassassin', '$MessageRetentionTime')|| "15";
21 my $DelayToMove = $sadb->get_prop("LearnAsSpam", "DelayToMove") || $MessageRetentionTime ; # delay in day before moving files
22 $DelayToMove= $DelayToMove<$MessageRetentionTime ? $DelayToMove : 0; # set 0 to disable
23 @@ -184,7 +187,7 @@ foreach my $user (@users) {
24 if (defined($sadb->get_prop($mode, "tag"))) {
25 # Opening, reading in one scalar and parsing mail
26 $/=undef;
27 - open(MAILFILE,$filetolearn);
28 + open(MAILFILE,"<:encoding(UTF-8)",$filetolearn);
29 my $emailbrut = <MAILFILE>;
30 close(MAILFILE);
31 $/="\n";
32 @@ -193,12 +196,14 @@ foreach my $user (@users) {
33 #changing subject (tagging), opening and writing new mail
34 my $Subject= $email->header("Subject");
35 if ( ($mode ne "LearnAsSpam") && ($sadb->get_prop($mode, "RemoveSPAMTag") eq "enabled") ) {
36 - ($Subject= $Subject) =~ s/$subjectTAG//;
37 - my $tag= $sadb->get_prop("LearnAsSpam", "tag");
38 - ($Subject= $Subject) =~ s/$tag//;
39 + for my $test ( quotemeta $subjectTAG , quotemeta $tag) {
40 + ($Subject= $Subject) =~ s/$test//;
41 + }
42 }
43 - $email->header_set("Subject", $sadb->get_prop($mode, "tag").$Subject);
44 - open(MAILFILEWRITE,">$filetolearn");
45 + # encoding as MIME Q (not B) with UTF8 as default.
46 + my $cleanTag= encode("MIME-Q",$sadb->get_prop($mode, "tag"));
47 + $email->header_set("Subject",$cleanTag.$Subject);
48 + open(MAILFILEWRITE,">","$filetolearn");
49 print(MAILFILEWRITE $email->as_string);
50 close(MAILFILEWRITE)
51 }

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed