mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2024-12-12 10:45:14 +02:00
rspamd multimap redis stuff doesn't work as expected...
This commit is contained in:
parent
1faeadb786
commit
d58b89528f
@ -6,10 +6,16 @@ RCPT_MAILCOW_DOMAIN {
|
||||
|
||||
RCPT_WANTS_SUBJECT_TAG {
|
||||
type = "rcpt";
|
||||
filter = "email:addr"
|
||||
filter = "email:addr";
|
||||
map = "redis://RCPT_WANTS_SUBJECT_TAG";
|
||||
}
|
||||
|
||||
RCPT_WANTS_SUBFOLDER_TAG {
|
||||
type = "rcpt";
|
||||
filter = "email:addr";
|
||||
map = "redis://RCPT_WANTS_SUBFOLDER_TAG";
|
||||
}
|
||||
|
||||
WHITELISTED_FWD_HOST {
|
||||
type = "ip";
|
||||
map = "redis://WHITELISTED_FWD_HOST";
|
||||
|
@ -30,8 +30,9 @@ rspamd_config:register_symbol({
|
||||
end
|
||||
|
||||
local wants_subject_tag = task:get_symbol("RCPT_WANTS_SUBJECT_TAG")
|
||||
local wants_subfolder_tag = task:get_symbol("RCPT_WANTS_SUBFOLDER_TAG")
|
||||
|
||||
if wants_subject_tag == 1 then
|
||||
if wants_subject_tag then
|
||||
rspamd_logger.infox("user wants subject modified for tagged mail")
|
||||
local sbj = task:get_header('Subject')
|
||||
new_sbj = '=?UTF-8?B?' .. tostring(util.encode_base64('[' .. tag .. '] ' .. sbj)) .. '?='
|
||||
@ -39,7 +40,7 @@ rspamd_config:register_symbol({
|
||||
remove_headers = {['Subject'] = 1},
|
||||
add_headers = {['Subject'] = new_sbj}
|
||||
})
|
||||
elseif wants_subject_tag == 2 then
|
||||
elseif wants_subfolder_tag then
|
||||
rspamd_logger.infox("Add X-Moo-Tag header")
|
||||
task:set_milter_reply({
|
||||
add_headers = {['X-Moo-Tag'] = 'YES'}
|
||||
|
@ -1298,6 +1298,7 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
||||
if (isset($_data['tagged_mail_handler']) && $_data['tagged_mail_handler'] == "subject") {
|
||||
try {
|
||||
$redis->hSet('RCPT_WANTS_SUBJECT_TAG', $username, 1);
|
||||
$redis->hDel('RCPT_WANTS_SUBFOLDER_TAG', $username);
|
||||
}
|
||||
catch (RedisException $e) {
|
||||
$_SESSION['return'] = array(
|
||||
@ -1309,7 +1310,8 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
||||
}
|
||||
else if (isset($_data['tagged_mail_handler']) && $_data['tagged_mail_handler'] == "subfolder") {
|
||||
try {
|
||||
$redis->hSet('RCPT_WANTS_SUBJECT_TAG', $username, 2);
|
||||
$redis->hSet('RCPT_WANTS_SUBFOLDER_TAG', $username, 1);
|
||||
$redis->hDel('RCPT_WANTS_SUBJECT_TAG', $username);
|
||||
}
|
||||
catch (RedisException $e) {
|
||||
$_SESSION['return'] = array(
|
||||
@ -1322,6 +1324,7 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
||||
else {
|
||||
try {
|
||||
$redis->hDel('RCPT_WANTS_SUBJECT_TAG', $username);
|
||||
$redis->hDel('RCPT_WANTS_SUBFOLDER_TAG', $username);
|
||||
}
|
||||
catch (RedisException $e) {
|
||||
$_SESSION['return'] = array(
|
||||
@ -2631,11 +2634,10 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
|
||||
$_data = $_SESSION['mailcow_cc_username'];
|
||||
}
|
||||
try {
|
||||
$wants_subject_tag = $redis->hGet('RCPT_WANTS_SUBJECT_TAG', $_data);
|
||||
if ($wants_subject_tag == 1) {
|
||||
if ($redis->hGet('RCPT_WANTS_SUBJECT_TAG', $_data)) {
|
||||
return "subject";
|
||||
}
|
||||
elseif ($wants_subject_tag == 2) {
|
||||
elseif ($redis->hGet('RCPT_WANTS_SUBFOLDER_TAG', $_data)) {
|
||||
return "subfolder";
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user