### Calculate rule actions {{{
if jmapquery "{\"someInThreadHaveKeyword\":\"$followed\"}" {
set "threadstatus" "followed";
addflag "$followed";
} elsif jmapquery "{\"someInThreadHaveKeyword\":\"$muted\"}" {
set "threadstatus" "muted";
addflag "$muted";
}
# No user configured rules
### }}}
### Execute rule actions {{{
# Muted/followed
if string :is "${threadstatus}" "followed" {
addflag "$notify";
}
elsif string :is "${threadstatus}" "muted" {
removeflag "$notify";
set "skipinbox" "Y";
}
# Delete/spam always skips inbox
if anyof(
string :is "${deletetotrash}" "Y",
string :is "${spam}" "Y"
) {
set "skipinbox" "Y";
}
# Copies always get marked read for better compatibility with IMAP clients
# and labels mode.
if anyof(
string :is "${read}" "Y",
not string :is "${skipinbox}" "Y"
) {
if hasflag "\\Seen" {
set "read" "Y";
} else {
addflag "\\Seen";
}
}
# Similarly, only the inbox copy gets flagged
if allof(
string :is "${flagged}" "Y",
string :is "${skipinbox}" "Y"
) {
addflag "\\Flagged";
}
# Rule sent message to trash
if string :is "${deletetotrash}" "Y" {
fileinto :specialuse "\\Trash" "INBOX.Trash";
}
# Rule says message is spam
elsif string :is "${spam}" "Y" {
fileinto :specialuse "\\Junk" "INBOX.Spam";
}
# Otherwise, do rule actions
else {
### Sieve generated for calendar preferences {{{
set "processimip_outcome" "no_action";
set "processimip_error" "";
if header :contains "X-Spam-Known-Sender" "in-addressbook" {
processcalendar :allowpublic :outcome "processimip_outcome" :reason "processimip_error" :deletecancelled :calendarid "57F34C08-E011-11EF-925B-58C65685D807";
}
else {
processcalendar :allowpublic :outcome "processimip_outcome" :reason "processimip_error" :deletecancelled :updatesonly;
}
if string :is "${processimip_outcome}" ["added","updated"] {
}
elsif not string :is "${processimip_outcome}" "no_action" {
addheader "X-ME-Cal-Outcome" "${processimip_outcome}";
addheader "X-ME-Cal-Error" "${processimip_error}";
}
### }}}
### File into folder actions {{{
# Then archive or clear implicit keep if skipping inbox
if string :is "${skipinbox}" "Y" {
if not string :is "${hasmailbox}" "Y" {
fileinto
:specialuse "\\Archive"
"INBOX.Archive";
} else {
discard;
}
} else {
# Set flags for inbox copy
if not string :is "${read}" "Y" {
removeflag "\\Seen";
}
if string :is "${flagged}" "Y" {
addflag "\\Flagged";
}
# MailFetch stop action
}
### }}}
### Sieve generated for vacation responses {{{
# You do not have vacation responses enabled.
### }}}
}
### }}}
if string :is "${stop}" "Y" {
stop;
}