1 |
unnilennium |
1.1 |
diff -up smeserver-learn-1.0/root/usr/bin/Learn.pl.MOVE smeserver-learn-1.0/root/usr/bin/Learn.pl |
2 |
|
|
--- smeserver-learn-1.0/root/usr/bin/Learn.pl.MOVE 2016-03-16 11:20:03.245000000 -0400 |
3 |
|
|
+++ smeserver-learn-1.0/root/usr/bin/Learn.pl 2016-03-16 11:27:32.880000000 -0400 |
4 |
|
|
@@ -43,6 +43,7 @@ my $agesecs=60*60*24*$DelayToMove; |
5 |
|
|
my $daysago=time-$agesecs; #the time stamp of $agedays ago in seconds |
6 |
|
|
my $daysago2=localtime($daysago); #the time stamp of $agedays ago in words - mainly for printing |
7 |
|
|
my $SpamLinks = $sadb->get_prop("LearnAsSpam", "SpamLinks") or ""; |
8 |
|
|
+my @files; |
9 |
|
|
|
10 |
|
|
#getting user list |
11 |
|
|
my @users = $adb->users; |
12 |
|
|
@@ -69,7 +70,7 @@ foreach my $user (@users) { |
13 |
|
|
|
14 |
|
|
printf("Checking for user (%s): %s %s\n", $key,$firstname, $lastname); |
15 |
|
|
|
16 |
|
|
- my $MailDir = ($key eq "admin")? "/home/e-smith/" . "/Maildir" : "/home/e-smith/files/users/" . $key . "/Maildir"; |
17 |
|
|
+ my $MailDir = ($key eq "admin")? "/home/e-smith" . "/Maildir" : "/home/e-smith/files/users/" . $key . "/Maildir"; |
18 |
|
|
|
19 |
|
|
my @modes = ("LearnAsSpam","LearnAsHam","LearnInWL"); |
20 |
|
|
foreach my $mode (@modes) { |
21 |
|
|
@@ -122,7 +123,7 @@ foreach my $user (@users) { |
22 |
|
|
if ($mode eq "LearnAsSpam" and $sadb->get_prop($mode, "DeleteAfterLearn") eq "enabled" and $DelayToMove >0) { |
23 |
|
|
my $SpamDir = $MailDir . "/" . $logdir . "/cur/"; |
24 |
|
|
return unless (-e $SpamDir and -d $SpamDir); |
25 |
|
|
- my @files; |
26 |
|
|
+ @files=(); |
27 |
|
|
find(\&wanted, $junkdir ."/cur" ); |
28 |
|
|
find(\&wanted, $junkdir ."/new" ) if ($sadb->get_prop($mode, "LearnNew") eq "enabled" or $sadb->get_prop($mode, "LearnNew") eq "junkmail"); |
29 |
|
|
sub wanted { |
30 |
|
|
@@ -137,8 +138,7 @@ foreach my $user (@users) { |
31 |
|
|
undef @files; |
32 |
|
|
foreach $filename (sort keys %filehash){ |
33 |
|
|
print "--> moving $filename $filehash{$filename}\n"; |
34 |
|
|
- my $flname = basename($filename); |
35 |
|
|
- move $filename,"$Learndir/$flname" ; |
36 |
|
|
+ move $filename,"$MailDir/$dirname/cur" ; |
37 |
|
|
} |
38 |
|
|
} |
39 |
|
|
|