]> Git — Sourcephile - sourcephile-nix.git/blob - hosts/mermet/dovecot/sieve/global/list.sieve
mermet: dovecot: try to fix list.sieve
[sourcephile-nix.git] / hosts / mermet / dovecot / sieve / global / list.sieve
1 require [ "date", "envelope", "fileinto", "mailbox", "subaddress", "variables" ];
2
3 #if currentdate :matches "year" "*" { set "year" "${1}"; }
4 #if currentdate :matches "month" "*" { set "month" "${1}"; }
5
6 if exists "X-MC-User" {
7 if header :matches "From" "*<*@*.asso.fr>*" {
8 fileinto :create "Listes+${3}";
9 stop;
10 }
11 elsif header :matches "From" "*<*@*.*>*" {
12 fileinto :create "Listes+${3}+${2}";
13 stop;
14 }
15 }
16 elsif exists "List-Id" {
17 if allof (header :matches "List-Id" "*<*/*.*.lists.sr.ht>*", not string :is "${2}" "", not string :is "${3}" "", not string :is "${4}" "") {
18 fileinto :create "Listes+sr-ht+${2}+${3}+${4}";
19 stop;
20 }
21 elsif allof (header :matches "List-Id" "*<*/*.lists.sr.ht>*", not string :is "${2}" "", not string :is "${3}" "") {
22 fileinto :create "Listes+sr-ht+${2}+${3}";
23 stop;
24 }
25 elsif allof (header :matches "List-Id" "*<*.*.*.*>*", not string :is "${2}" "", not string :is "${3}" "", not string :is "${4}" "") {
26 fileinto :create "Listes+${4}+${3}+${2}";
27 stop;
28 }
29 elsif allof (header :matches "List-Id" "*<*.*.*>*", not string :is "${2}" "", not string :is "${3}" "") {
30 fileinto :create "Listes+${3}+${2}";
31 stop;
32 }
33 }
34
35 if envelope :matches :detail "TO" "*" { set "extension" "${1}"; }
36 if not string :is "${extension}" "" {
37 fileinto :create "Listes+${extension}";
38 stop;
39 }