Merge pull request #915 from tiirex9/master

Adds 'do nothing' as default for sub-addressing
master
André Peters 2018-01-18 10:27:14 +01:00 committed by GitHub
commit 5648ec6d39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 44 additions and 4 deletions

View File

@ -6,10 +6,16 @@ RCPT_MAILCOW_DOMAIN {
RCPT_WANTS_SUBJECT_TAG { RCPT_WANTS_SUBJECT_TAG {
type = "rcpt"; type = "rcpt";
filter = "email:addr" filter = "email:addr";
map = "redis://RCPT_WANTS_SUBJECT_TAG"; map = "redis://RCPT_WANTS_SUBJECT_TAG";
} }
RCPT_WANTS_SUBFOLDER_TAG {
type = "rcpt";
filter = "email:addr";
map = "redis://RCPT_WANTS_SUBFOLDER_TAG";
}
WHITELISTED_FWD_HOST { WHITELISTED_FWD_HOST {
type = "ip"; type = "ip";
map = "redis://WHITELISTED_FWD_HOST"; map = "redis://WHITELISTED_FWD_HOST";

View File

@ -30,6 +30,7 @@ rspamd_config:register_symbol({
end end
local wants_subject_tag = task:get_symbol("RCPT_WANTS_SUBJECT_TAG") 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 then if wants_subject_tag then
rspamd_logger.infox("user wants subject modified for tagged mail") rspamd_logger.infox("user wants subject modified for tagged mail")
@ -39,7 +40,7 @@ rspamd_config:register_symbol({
remove_headers = {['Subject'] = 1}, remove_headers = {['Subject'] = 1},
add_headers = {['Subject'] = new_sbj} add_headers = {['Subject'] = new_sbj}
}) })
else elseif wants_subfolder_tag then
rspamd_logger.infox("Add X-Moo-Tag header") rspamd_logger.infox("Add X-Moo-Tag header")
task:set_milter_reply({ task:set_milter_reply({
add_headers = {['X-Moo-Tag'] = 'YES'} add_headers = {['X-Moo-Tag'] = 'YES'}

View File

@ -1308,6 +1308,20 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
if (isset($_data['tagged_mail_handler']) && $_data['tagged_mail_handler'] == "subject") { if (isset($_data['tagged_mail_handler']) && $_data['tagged_mail_handler'] == "subject") {
try { try {
$redis->hSet('RCPT_WANTS_SUBJECT_TAG', $username, 1); $redis->hSet('RCPT_WANTS_SUBJECT_TAG', $username, 1);
$redis->hDel('RCPT_WANTS_SUBFOLDER_TAG', $username);
}
catch (RedisException $e) {
$_SESSION['return'] = array(
'type' => 'danger',
'msg' => 'Redis: '.$e
);
return false;
}
}
else if (isset($_data['tagged_mail_handler']) && $_data['tagged_mail_handler'] == "subfolder") {
try {
$redis->hSet('RCPT_WANTS_SUBFOLDER_TAG', $username, 1);
$redis->hDel('RCPT_WANTS_SUBJECT_TAG', $username);
} }
catch (RedisException $e) { catch (RedisException $e) {
$_SESSION['return'] = array( $_SESSION['return'] = array(
@ -1320,6 +1334,7 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
else { else {
try { try {
$redis->hDel('RCPT_WANTS_SUBJECT_TAG', $username); $redis->hDel('RCPT_WANTS_SUBJECT_TAG', $username);
$redis->hDel('RCPT_WANTS_SUBFOLDER_TAG', $username);
} }
catch (RedisException $e) { catch (RedisException $e) {
$_SESSION['return'] = array( $_SESSION['return'] = array(
@ -2632,9 +2647,12 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
if ($redis->hGet('RCPT_WANTS_SUBJECT_TAG', $_data)) { if ($redis->hGet('RCPT_WANTS_SUBJECT_TAG', $_data)) {
return "subject"; return "subject";
} }
else { elseif ($redis->hGet('RCPT_WANTS_SUBFOLDER_TAG', $_data)) {
return "subfolder"; return "subfolder";
} }
else {
return "none";
}
} }
catch (RedisException $e) { catch (RedisException $e) {
$_SESSION['return'] = array( $_SESSION['return'] = array(
@ -3729,4 +3747,4 @@ function mailbox($_action, $_type, $_data = null, $attr = null) {
} }
break; break;
} }
} }

View File

@ -176,6 +176,7 @@ $lang['user']['misc_delete_profile'] = 'Sonstige Kontoeinstellungen';
$lang['user']['tag_handling'] = 'Umgang mit getaggten E-Mails steuern'; $lang['user']['tag_handling'] = 'Umgang mit getaggten E-Mails steuern';
$lang['user']['tag_in_subfolder'] = 'In Unterordner'; $lang['user']['tag_in_subfolder'] = 'In Unterordner';
$lang['user']['tag_in_subject'] = 'In Betreff'; $lang['user']['tag_in_subject'] = 'In Betreff';
$lang['user']['tag_in_none'] = 'Nichts tun';
$lang['user']['tag_help_explain'] = 'Als Unterordner: Es wird ein Ordner mit dem Namen des Tags unterhalb der Inbox erstellt ("INBOX/Facebook").<br> $lang['user']['tag_help_explain'] = 'Als Unterordner: Es wird ein Ordner mit dem Namen des Tags unterhalb der Inbox erstellt ("INBOX/Facebook").<br>
In Betreff: Der Name des Tags wird dem Betreff angefügt, etwa "[Facebook] Meine Neuigkeiten".'; In Betreff: Der Name des Tags wird dem Betreff angefügt, etwa "[Facebook] Meine Neuigkeiten".';
$lang['user']['tag_help_example'] = 'Beispiel für eine getaggte E-Mail-Adresse: ich<b>+Facebook</b>@example.org'; $lang['user']['tag_help_example'] = 'Beispiel für eine getaggte E-Mail-Adresse: ich<b>+Facebook</b>@example.org';

View File

@ -175,6 +175,7 @@ $lang['user']['misc_delete_profile'] = 'Other profile settings';
$lang['user']['tag_handling'] = 'Set handling for tagged mail'; $lang['user']['tag_handling'] = 'Set handling for tagged mail';
$lang['user']['tag_in_subfolder'] = 'In subfolder'; $lang['user']['tag_in_subfolder'] = 'In subfolder';
$lang['user']['tag_in_subject'] = 'In subject'; $lang['user']['tag_in_subject'] = 'In subject';
$lang['user']['tag_in_none'] = 'Do nothing';
$lang['user']['tag_help_explain'] = 'In subfolder: a new subfolder named after the tag will be created below INBOX ("INBOX/Facebook").<br> $lang['user']['tag_help_explain'] = 'In subfolder: a new subfolder named after the tag will be created below INBOX ("INBOX/Facebook").<br>
In subject: the tags name will be prepended to the mails subject, example: "[Facebook] My News".'; In subject: the tags name will be prepended to the mails subject, example: "[Facebook] My News".';
$lang['user']['tag_help_example'] = 'Example for a tagged email address: me<b>+Facebook</b>@example.org'; $lang['user']['tag_help_example'] = 'Example for a tagged email address: me<b>+Facebook</b>@example.org';

View File

@ -144,6 +144,7 @@ $lang['user']['misc_delete_profile'] = 'Otras configuraciones de usuario';
$lang['user']['tag_handling'] = 'Establecer manejo para el correo etiquetado'; $lang['user']['tag_handling'] = 'Establecer manejo para el correo etiquetado';
$lang['user']['tag_in_subfolder'] = 'En subcarpeta'; $lang['user']['tag_in_subfolder'] = 'En subcarpeta';
$lang['user']['tag_in_subject'] = 'En asunto'; $lang['user']['tag_in_subject'] = 'En asunto';
$lang['user']['tag_in_none'] = 'Hacer nada';
$lang['user']['tag_help_explain'] = 'En subcarpeta: una nueva subcarpeta llamada como la etiqueta será creada debajo de INBOX ("INBOX/Facebook").<br> $lang['user']['tag_help_explain'] = 'En subcarpeta: una nueva subcarpeta llamada como la etiqueta será creada debajo de INBOX ("INBOX/Facebook").<br>
En asunto: los nombres de las etiquetas serán añadidos al asunto de los correos, ejemplo: "[Facebook] Mis Noticias".'; En asunto: los nombres de las etiquetas serán añadidos al asunto de los correos, ejemplo: "[Facebook] Mis Noticias".';
$lang['user']['tag_help_example'] = 'Ejemplo de una dirección email etiquetada: mi<b>+Facebook</b>@ejemplo.org'; $lang['user']['tag_help_example'] = 'Ejemplo de una dirección email etiquetada: mi<b>+Facebook</b>@ejemplo.org';

View File

@ -167,6 +167,7 @@ $lang['user']['misc_delete_profile'] = "Autre paramètres de profil";
$lang['user']['tag_handling'] = "Définir la gestion des courriel étiquetés"; $lang['user']['tag_handling'] = "Définir la gestion des courriel étiquetés";
$lang['user']['tag_in_subfolder'] = "Dans un sous-dossier"; $lang['user']['tag_in_subfolder'] = "Dans un sous-dossier";
$lang['user']['tag_in_subject'] = "Dans l'objet"; $lang['user']['tag_in_subject'] = "Dans l'objet";
$lang['user']['tag_in_none'] = "Ne fais rien";
$lang['user']['tag_help_explain'] = "Dans un sous-dossier : a nouveau sous-dossier portant le nom de l'étiquette sera crée sous INBOX (\"INBOX/Facebook\").<br>Dans l'objet : le nom de l'étiquette sera accolé à l'objet du courriel. Par exemple : \"[Facebook] Mes Nouvelles\"."; $lang['user']['tag_help_explain'] = "Dans un sous-dossier : a nouveau sous-dossier portant le nom de l'étiquette sera crée sous INBOX (\"INBOX/Facebook\").<br>Dans l'objet : le nom de l'étiquette sera accolé à l'objet du courriel. Par exemple : \"[Facebook] Mes Nouvelles\".";
$lang['user']['tag_help_example'] = "Exemple pour une adresse de courriel étiquetée : moi<b>+Facebook</b>@exemple.org"; $lang['user']['tag_help_example'] = "Exemple pour une adresse de courriel étiquetée : moi<b>+Facebook</b>@exemple.org";
$lang['user']['eas_reset'] = "Réinitialiser le cache de l'appareil ActiveSync"; $lang['user']['eas_reset'] = "Réinitialiser le cache de l'appareil ActiveSync";

View File

@ -167,6 +167,7 @@ $lang['user']['misc_delete_profile'] = 'Impostazioni di altri profili';
$lang['user']['tag_handling'] = 'Imposta le gestione della mail evidenziate'; $lang['user']['tag_handling'] = 'Imposta le gestione della mail evidenziate';
$lang['user']['tag_in_subfolder'] = 'Nella sotto cartella'; $lang['user']['tag_in_subfolder'] = 'Nella sotto cartella';
$lang['user']['tag_in_subject'] = 'Nell\'oggetto'; $lang['user']['tag_in_subject'] = 'Nell\'oggetto';
$lang['user']['tag_in_none'] = "Fare niente";
$lang['user']['tag_help_explain'] = 'In sotto cartelle: Una nuova cartella dal nome del tag verrà creata sotto INBOX ("INBOX/Facebook").<br /> $lang['user']['tag_help_explain'] = 'In sotto cartelle: Una nuova cartella dal nome del tag verrà creata sotto INBOX ("INBOX/Facebook").<br />
Nell\'oggetto: Il nome del tag verrà aggiunto all\'inizio dell\'oggetto mail, esempio: "[Facebook] Meine Neuigkeiten".'; Nell\'oggetto: Il nome del tag verrà aggiunto all\'inizio dell\'oggetto mail, esempio: "[Facebook] Meine Neuigkeiten".';
$lang['user']['tag_help_example'] = 'Esempio di mail con tag: ich<b>+Facebook</b>@example.org'; $lang['user']['tag_help_example'] = 'Esempio di mail con tag: ich<b>+Facebook</b>@example.org';

View File

@ -140,6 +140,7 @@ $lang['user']['misc_delete_profile'] = 'Andere profielinstellingen';
$lang['user']['tag_handling'] = 'Omgaan met e-mail tags'; $lang['user']['tag_handling'] = 'Omgaan met e-mail tags';
$lang['user']['tag_in_subfolder'] = 'In onderliggende map'; $lang['user']['tag_in_subfolder'] = 'In onderliggende map';
$lang['user']['tag_in_subject'] = 'In onderwerp'; $lang['user']['tag_in_subject'] = 'In onderwerp';
$lang['user']['tag_in_none'] = 'Niets doen';
$lang['user']['tag_help_explain'] = 'In onderliggende map: maakt onder INBOX een nieuwe map aan met de naam van de tag (bijv.: "INBOX/Facebook").<br> $lang['user']['tag_help_explain'] = 'In onderliggende map: maakt onder INBOX een nieuwe map aan met de naam van de tag (bijv.: "INBOX/Facebook").<br>
In onderwerp: de tag wordt vóór het oorspronkelijke e-mail onderwerp geplaatst (bijv.: "[Facebook] Mijn nieuws").'; In onderwerp: de tag wordt vóór het oorspronkelijke e-mail onderwerp geplaatst (bijv.: "[Facebook] Mijn nieuws").';
$lang['user']['tag_help_example'] = 'Voorbeeld van een e-mailadres met tag: ik<b>+Facebook</b>@voorbeeld.org'; $lang['user']['tag_help_example'] = 'Voorbeeld van een e-mailadres met tag: ik<b>+Facebook</b>@voorbeeld.org';

View File

@ -169,6 +169,7 @@ $lang['user']['misc_delete_profile'] = 'Ustawienia innego profilu';
$lang['user']['tag_handling'] = 'Ustaw obsługę znaczników pocztowych'; $lang['user']['tag_handling'] = 'Ustaw obsługę znaczników pocztowych';
$lang['user']['tag_in_subfolder'] = 'W podfolderze'; $lang['user']['tag_in_subfolder'] = 'W podfolderze';
$lang['user']['tag_in_subject'] = 'W temacie'; $lang['user']['tag_in_subject'] = 'W temacie';
$lang['user']['tag_in_none'] = 'Nic nie robić';
$lang['user']['tag_help_explain'] = 'W podfolderze: tworzy nowy podfolder z nazwą taką jak etykieta, który zostanie umieszczony pod Skrzynką odbiorczą ("Skrzynka odbiorcza/Facebook").<br> $lang['user']['tag_help_explain'] = 'W podfolderze: tworzy nowy podfolder z nazwą taką jak etykieta, który zostanie umieszczony pod Skrzynką odbiorczą ("Skrzynka odbiorcza/Facebook").<br>
W temacie: nazwy etykiet zostaną dodane na początku tematów wiadomości, np.: "[Facebook] Moje wiadomości".'; W temacie: nazwy etykiet zostaną dodane na początku tematów wiadomości, np.: "[Facebook] Moje wiadomości".';
$lang['user']['tag_help_example'] = 'Przykład adresu email z etykietą: ja<b>+Facebook</b>@example.org'; $lang['user']['tag_help_example'] = 'Przykład adresu email z etykietą: ja<b>+Facebook</b>@example.org';

View File

@ -167,6 +167,7 @@ $lang['user']['misc_delete_profile'] = 'Другие настройки проф
$lang['user']['tag_handling'] = 'Set handling for tagged mail'; $lang['user']['tag_handling'] = 'Set handling for tagged mail';
$lang['user']['tag_in_subfolder'] = 'В подпапку'; $lang['user']['tag_in_subfolder'] = 'В подпапку';
$lang['user']['tag_in_subject'] = 'В теме'; $lang['user']['tag_in_subject'] = 'В теме';
$lang['user']['tag_in_none'] = 'Ничего не делать';
$lang['user']['tag_help_explain'] = 'In subfolder: a new subfolder named after the tag will be created below INBOX ("INBOX/Facebook").<br> $lang['user']['tag_help_explain'] = 'In subfolder: a new subfolder named after the tag will be created below INBOX ("INBOX/Facebook").<br>
In subject: the tags name will be prepended to the mails subject, example: "[Facebook] Meine Neuigkeiten".'; In subject: the tags name will be prepended to the mails subject, example: "[Facebook] Meine Neuigkeiten".';
$lang['user']['tag_help_example'] = 'Example for a tagged email address: ich<b>+Facebook</b>@example.org'; $lang['user']['tag_help_example'] = 'Example for a tagged email address: ich<b>+Facebook</b>@example.org';

View File

@ -178,6 +178,13 @@ elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == '
data-api-url='edit/delimiter_action' data-api-url='edit/delimiter_action'
data-api-attr='{"tagged_mail_handler":"subject"}'><?=$lang['user']['tag_in_subject'];?></button> data-api-attr='{"tagged_mail_handler":"subject"}'><?=$lang['user']['tag_in_subject'];?></button>
<button type="button" class="btn btn-sm btn-default <?=($get_tagging_options == "none") ? 'active' : null; ?>"
id="edit_selected"
data-item="<?= $username; ?>"
data-id="delimiter_action"
data-api-url='edit/delimiter_action'
data-api-attr='{"tagged_mail_handler":"none"}'><?=$lang['user']['tag_in_none'];?></button>
</div> </div>
<p class="help-block"><?=$lang['user']['tag_help_explain'];?></p> <p class="help-block"><?=$lang['user']['tag_help_explain'];?></p>
<p class="help-block"><?=$lang['user']['tag_help_example'];?></p> <p class="help-block"><?=$lang['user']['tag_help_example'];?></p>