1 |
unnilennium |
1.1 |
diff -urN smeserver-learn-1.0.admin/createlinks smeserver-learn-1.0/createlinks |
2 |
|
|
--- smeserver-learn-1.0.admin/createlinks 2016-03-15 07:29:40.102000000 -0400 |
3 |
|
|
+++ smeserver-learn-1.0/createlinks 2016-03-15 07:39:54.135000000 -0400 |
4 |
|
|
@@ -4,5 +4,6 @@ |
5 |
|
|
|
6 |
|
|
|
7 |
|
|
templates2events("/etc/cron.d/Learn", qw(email-update bootstrap-console-save )); |
8 |
|
|
- |
9 |
|
|
+safe_touch('root/etc/e-smith/db/configuration/defaults/Learn/Exclude'); |
10 |
|
|
+safe_touch('root/etc/e-smith/db/configuration/defaults/Learn/Include'); |
11 |
|
|
|
12 |
|
|
diff -urN smeserver-learn-1.0.admin/root/usr/bin/Learn.pl smeserver-learn-1.0/root/usr/bin/Learn.pl |
13 |
|
|
--- smeserver-learn-1.0.admin/root/usr/bin/Learn.pl 2016-03-15 07:29:40.102000000 -0400 |
14 |
|
|
+++ smeserver-learn-1.0/root/usr/bin/Learn.pl 2016-03-15 07:32:10.000000000 -0400 |
15 |
|
|
@@ -43,6 +43,9 @@ |
16 |
|
|
|
17 |
|
|
#getting user list |
18 |
|
|
my @users = $adb->users; |
19 |
|
|
+#adding admin |
20 |
|
|
+my @admin = $adb->get('admin'); |
21 |
|
|
+push @users ,@admin; |
22 |
|
|
|
23 |
|
|
# getting WL before running |
24 |
|
|
open(SADB, "/home/e-smith/db/spamassassin"); |
25 |
|
|
@@ -55,10 +58,15 @@ |
26 |
|
|
my $firstname = $user->prop('FirstName'); |
27 |
|
|
my $lastname = $user->prop('LastName'); |
28 |
|
|
my $key = $user->key; |
29 |
|
|
+ # verification if user included or excluded |
30 |
|
|
+ my @include= split(',',$sadb->get_prop("Learn", "Include")) if $sadb->get_prop("Learn", "Include"); |
31 |
|
|
+ my @exclude= split(',',$sadb->get_prop("Learn", "Exclude")) if $sadb->get_prop("Learn", "Exclude"); |
32 |
|
|
+ next if ( defined @exclude and @found = grep { $_ eq $key } @exclude ); |
33 |
|
|
+ next unless ( ! defined @include or @found = grep { $_ eq $key } @include ); |
34 |
|
|
|
35 |
|
|
printf("Checking for user (%s): %s %s\n", $key,$firstname, $lastname); |
36 |
|
|
|
37 |
|
|
- my $MailDir = "/home/e-smith/files/users/" . $key . "/Maildir"; |
38 |
|
|
+ my $MailDir = ($key eq "admin")? "/home/e-smith/" . "/Maildir" : "/home/e-smith/files/users/" . $key . "/Maildir"; |
39 |
|
|
|
40 |
|
|
my @modes = ("LearnAsSpam","LearnAsHam","LearnInWL"); |
41 |
|
|
foreach my $mode (@modes) { |