Honor per-user spam settings, fixes #21
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
connect = /data/freeposte.db
|
||||
|
||||
map {
|
||||
pattern = priv/spam_enabled
|
||||
table = user
|
||||
username_field = email
|
||||
value_field = spam_enabled
|
||||
}
|
||||
|
||||
map {
|
||||
pattern = priv/spam_threshold
|
||||
table = user
|
||||
username_field = email
|
||||
value_field = spam_threshold
|
||||
}
|
||||
|
||||
map {
|
||||
pattern = priv/reply_enabled
|
||||
table = user
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
require ["fileinto", "envelope", "mailbox", "imap4flags"];
|
||||
require ["variables", "fileinto", "envelope", "mailbox", "imap4flags", "regex", "relational", "comparator-i;ascii-numeric", "vnd.dovecot.extdata"];
|
||||
|
||||
if header :contains "X-Spam" "YES" {
|
||||
setflag "\\seen";
|
||||
fileinto :create "Junk";
|
||||
|
||||
if string :is "${extdata.spam_enabled}" "1" {
|
||||
if header :matches "X-Spam-Status" "* score=*" {
|
||||
if string :value "ge" :comparator "i;ascii-numeric" "${2}" "${extdata.spam_threshold}" {
|
||||
setflag "\\seen";
|
||||
fileinto :create "Junk";
|
||||
stop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user