james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gautier DI FOLCO (JIRA)" <server-...@james.apache.org>
Subject [jira] [Created] (JAMES-2530) [Filter]
Date Thu, 23 Aug 2018 11:25:00 GMT
Gautier DI FOLCO created JAMES-2530:
---------------------------------------

             Summary: [Filter]
                 Key: JAMES-2530
                 URL: https://issues.apache.org/jira/browse/JAMES-2530
             Project: James Server
          Issue Type: Improvement
          Components: JMAP
            Reporter: Gautier DI FOLCO
            Assignee: Antoine Duprat


h1. JMap filtering spec

A Filter is a per-user singleton ordered list of Rules.
For each received mail the Filter is triggered by walk in the order through the Rule until
a condition is met, which selects the corresponding Rule.
Once the selection is done, the action part is executed and we consider the filtering as done.
h2. Objects
h3. Rule

 - id: String 
 - name: String
 - condition: Condition
 - action: Action
h3. Action

 - mailboxIds: [String]
h3. Condition

 - field: String we manage the following fields: from, to, cc, subject, recipient (to or
cc)
 - comparator: String we manage the following behavior: contains, not-contains, exactly-equals,
not-exactly-equals
value: String
h2. Methods
h3. setFilter

setFilter takes only one parameter which is all the Rules.
{code:java}
[[
    "setFilter",
  { "ifInState": "4011", //can be null
    "singleton": [
    {
        "id": "42-ac",
      "name": "My first rule"
      "condition": {
        "field": "from",
        "comparator": "exactly-equals"
        "value": "marvin@h2.g2"
      },
      "action": {
        "mailboxIds": ["5"]
      }
    },
    {
        "id": "3000-34e",
      "name": "My last rule"
      "condition": {
        "field": "subject",
        "comparator": "contains"
        "value": "question"
      },
      "action": {
        "mailboxIds": ["7", "2", "5"]
      }
    }
  ]},
  "#0"
]]{code}
h3. getFilter

getFilter takes no parameters and returns the filter with all the Rules.
{code:java}
{
    "getFilter",
  {},
  "#0"
}{code}

Will return:
{code:java}
[[
  "filter",
  { "state": "4012",
    "singleton": [
    {
        "id": "42-ac",
      "name": "My first rule"
      "condition": {
        "field": "from",
        "comparator": "exactly-equals"
        "value": "marvin@h2.g2"
      },
      "action": {
        "mailboxIds": ["5"]
      }
    },
    {
        "id": "3000-34e",
      "name": "My last rule"
      "condition": {
        "field": "subject",
        "comparator": "contains"
        "value": "question"
      },
      "action": {
        "mailboxIds": ["7", "2", "5"]
      }
    }
  ]},
  "#0"
]]{code}
 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message