Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-2530

[Filter] Implement JMAP layer

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.2.0
    • JMAP
    • None

    Description

      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.

      Objects

      Rule

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

      Action

       - mailboxIds: [String]

      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

      Methods

      setFilter

      setFilter takes only one parameter which is all the Rules.

      [[
          "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"
      ]]

      getFilter

      getFilter takes no parameters and returns the filter with all the Rules.

      {
          "getFilter",
        {},
        "#0"
      }

      Will return:

      [[
        "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"
      ]]

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            aduprat Antoine Duprat
            gdifolco Gautier DI FOLCO
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment