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

Annotation of /rpms/smeserver-learn/contribs10/smeserver-learn-1.0-SME9284.patch

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


Revision 1.1 - (hide annotations) (download)
Sun Dec 20 11:47:14 2020 UTC (3 years, 5 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 brianr 1.1 diff -Nur smeserver-learn-1.0/root/usr/bin/Learn.pl.MESSYOUTPUT smeserver-learn-1.0/root/usr/bin/Learn.pl
2     --- smeserver-learn-1.0/root/usr/bin/Learn.pl.MESSYOUTPUT 2016-03-07 11:00:23.000000000 +0100
3     +++ smeserver-learn-1.0/root/usr/bin/Learn.pl 2016-03-08 08:21:55.000000000 +0100
4     @@ -85,8 +85,8 @@
5     if (! @logdirs and ($sadb->get_prop($mode, "Uniq") eq "enabled")) {
6     ($login,$pass,$uid,$gid) = getpwnam($key)
7     or die "$key not in passwd file";
8     + print "+->mkdir :". $MailDir . "/" . $dirname . "\n";
9     foreach $a ('','/cur','/tmp','/new'){
10     - print "mkdir :". $MailDir . "/" . $dirname . "$a\n";
11     mkdir $MailDir . "/" . $dirname . "$a";
12     chown $uid,$gid,$MailDir . "/" . $dirname . "$a";
13     }
14     @@ -100,7 +100,7 @@
15     $a=(substr($a, 0, 1) eq '.')? $a: ".$a";
16     my $Link= $MailDir . "/" . $a;
17     if (! -e $Link) {
18     - print "create link $Link on $junkdir\n";
19     + print "+->create link $Link on $junkdir\n";
20     symlink($junkdir, $Link) or die "Can't create symlink from $Link to $junkdir: $!";
21     };
22     }
23     @@ -137,20 +137,21 @@
24     #sa-learn here to avoid its loading for each files, when it can walk in directories on itself!
25     my $SpamDir = ($sadb->get_prop($mode, "LearnNew") eq "enabled")? $MailDir . "/" . $logdir : $MailDir . "/" . $logdir . "/cur/" ;
26     #taking action according to actual mode
27     - if ($mode eq "LearnAsSpam") {
28     - my $result = `/usr/bin/sa-learn --spam --showdots $SpamDir`;
29     - printf("Learning Spam from %s: %s\n",$SpamDir,$result);
30     + my $counter = 0;
31     + find( { wanted => sub { -f && $counter++;}, no_chdir => 1, follow_fast => 1 }, $SpamDir );
32     + if ($mode eq "LearnAsSpam" and $counter>0) {
33     + my $result = `/usr/bin/sa-learn --spam $SpamDir`;
34     + chomp($result); printf("+Learning Spam from %s: %s\n",$logdir,$result);
35     }
36     - elsif ($mode eq "LearnAsHam") {
37     - my $result = `/usr/bin/sa-learn --ham --showdots $SpamDir`;
38     - printf("Learning Ham from %s: %s\n",$SpamDir,$result);
39     + elsif ($mode eq "LearnAsHam" and $counter>0) {
40     + my $result = `/usr/bin/sa-learn --ham $SpamDir`;
41     + chomp($result);printf("+Learning Ham from %s: %s\n",$logdir,$result);
42     }
43    
44     @list= ($sadb->get_prop($mode, "LearnNew") eq "enabled") ? ('/cur/','/new/'):('/cur/');
45     foreach $a (@list){
46     - my $SpamDir = $MailDir . "/" . $logdir . "$a";#JPP why only the cur and not the new?
47     + my $SpamDir = $MailDir . "/" . $logdir . "$a";
48     # list and sort file in dir
49     - printf("Checking Dir: %s\n",$SpamDir);
50     opendir(SPAMDIR, $SpamDir);
51     my @spamfiles = sort grep { /$hostname/ } readdir(SPAMDIR);
52     closedir(SPAMDIR);
53     @@ -164,7 +165,7 @@
54    
55     #taking action according to actual mode
56     if ($mode eq "LearnInWL") {
57     - printf("Learning in WhiteList: %s\n",$filetolearnbash);
58     + printf("+Learning in WhiteList: %s\n",$filetolearnbash);
59     `/usr/bin/LearnInWL.pl $filetolearnbash`;
60     }
61     # if we are in LearnAsSpam mode and DeleteAfterLearn is enabled delete message, else tagging a move message

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