View Single Post
Old 31 Mar 2020, 03:29 AM   #1
n5bb
Intergalactic Postmaster
 
Join Date: May 2004
Location: Irving, Texas
Posts: 8,929
Arrow New rules and jmapquery

After moving to the new rules system and moving to label mode (in beta late March 2020), with no rules I see the following base sieve:
Code:
require ["fileinto", "reject", "vacation", "notify", "envelope", "body", "relational", "regex", "subaddress", "copy", "mailbox", "mboxmetadata", "servermetadata", "date", "index", "comparator-i;ascii-numeric", "variables", "imap4flags", "editheader", "duplicate", "vacation-seconds", "fcc", "x-cyrus-jmapquery"];

### 1. Sieve generated for save-on-SMTP identities
# You do not have any identities with special filing.

### 2. Sieve generated for blocked senders
# You have no blocked senders.

### 3. Sieve generated for spam protection
if not header :matches "X-Spam-Known-Sender" "yes*" {
  if 
    allof(
    header :contains "X-Backscatter" "yes",
    not header :matches "X-LinkName" "*"
    )
  {
    fileinto "\\Junk";
    stop;
  }
  if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-score" "5" {
    fileinto "\\Junk";
    stop;
  }
}


### 4. User configured rules

### 4a. Calculate rule actions

# No user configured rules

### 4b. Rule sent message to trash
if string :is "${deletetotrash}" "Y" {
  fileinto "\\Trash";
}

### 4c. Rule says message is spam
elsif string :is "${spam}" "Y" {
  fileinto "\\Junk";
}

### 4d. Do rule actions
else {
  if string :is "${skipinbox}" "Y" {
    if string :is "${hasmailbox}" "Y" {
      discard;
    }
    else {
      fileinto "\\Archive";
    }
  }
  else {
    ### 4e. Sieve generated for fetch mail filing
    # You have no pop-links filing into special folders.
  }
  
  ### 5. Sieve generated for vacation responses
  # You do not have vacation responses enabled.
  
  ### 6. Sieve generated for calendar preferences
  if 
    allof(
    header :is "X-ME-Cal-Method" "request",
    not exists "X-ME-Cal-Exists",
    header :contains "X-Spam-Known-Sender" "in-addressbook"
    )
  {
    notify :method "addcal";
  }
  elsif exists "X-ME-Cal-Exists" {
    notify :method "updatecal";
  }
}

if string :is "${stop}" "Y" {
#   For backwards compatibility
}
If I add this one rule (everything else left at default):
Quote:
Matches subject:SNEEZE
Add label Testing - Continue to apply other rules
I then get the following sieve containing jmapquery in the ### 4a. Calculate rule actions code:

Code:
require ["fileinto", "reject", "vacation", "notify", "envelope", "body", "relational", "regex", "subaddress", "copy", "mailbox", "mboxmetadata", "servermetadata", "date", "index", "comparator-i;ascii-numeric", "variables", "imap4flags", "editheader", "duplicate", "vacation-seconds", "fcc", "x-cyrus-jmapquery"];

### 1. Sieve generated for save-on-SMTP identities
# You do not have any identities with special filing.

### 2. Sieve generated for blocked senders
# You have no blocked senders.

### 3. Sieve generated for spam protection
if not header :matches "X-Spam-Known-Sender" "yes*" {
  if 
    allof(
    header :contains "X-Backscatter" "yes",
    not header :matches "X-LinkName" "*"
    )
  {
    fileinto "\\Junk";
    stop;
  }
  if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-score" "5" {
    fileinto "\\Junk";
    stop;
  }
}


### 4. User configured rules

### 4a. Calculate rule actions

# Search: "subject:SNEEZE"
if 
  allof( not string :is "${stop}" "Y",
    jmapquery text:
  {
     "subject" : "SNEEZE"
  }
.
  )
{
  set "L0_Testing" "Y";
  
}

### 4b. Rule sent message to trash
if string :is "${deletetotrash}" "Y" {
  fileinto "\\Trash";
}

### 4c. Rule says message is spam
elsif string :is "${spam}" "Y" {
  fileinto "\\Junk";
}

### 4d. Do rule actions
else {
  if string :is "${L0_Testing}" "Y" {
    set "hasmailbox" "Y";
    fileinto :copy "INBOX.Testing";
  }
  if string :is "${skipinbox}" "Y" {
    if string :is "${hasmailbox}" "Y" {
      discard;
    }
    else {
      fileinto "\\Archive";
    }
  }
  else {
    ### 4e. Sieve generated for fetch mail filing
    # You have no pop-links filing into special folders.
  }
  
  ### 5. Sieve generated for vacation responses
  # You do not have vacation responses enabled.
  
  ### 6. Sieve generated for calendar preferences
  if 
    allof(
    header :is "X-ME-Cal-Method" "request",
    not exists "X-ME-Cal-Exists",
    header :contains "X-Spam-Known-Sender" "in-addressbook"
    )
  {
    notify :method "addcal";
  }
  elsif exists "X-ME-Cal-Exists" {
    notify :method "updatecal";
  }
}

if string :is "${stop}" "Y" {
#   For backwards compatibility
}
I hope this helps those wondering about how jmapquery appears in the new rules system.


Bill
n5bb is offline   Reply With Quote