Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tmail: Inject user contacts into auto-complete database #1163

Open
chibenwa opened this issue Aug 21, 2024 · 2 comments · May be fixed by #1215
Open

Tmail: Inject user contacts into auto-complete database #1163

chibenwa opened this issue Aug 21, 2024 · 2 comments · May be fixed by #1215
Assignees
Labels
enhancement New feature or request

Comments

@chibenwa
Copy link
Member

chibenwa commented Aug 21, 2024

Why

GIVEN I create [email protected] in OpenPaaS
WHEN I compose an email in Twake mail and type abc
THEN it proposes [email protected] as a potential recipient

How

Listen to exchange contacts:contact:add

Given

{
    "bookId": "65ae6175751dbd001b5799e8",
    "bookName": "contacts",
    "contactId": "fd9b3c98-fc77-4187-92ac-d9f58d400968",
    "userId": "65ae6175751dbd001b5799e8",
    "vcard": [
        "vcard",
        [
            [
                "version",
                {},
                "text",
                "4.0"
            ],
            [
                "uid",
                {},
                "text",
                "fd9b3c98-fc77-4187-92ac-d9f58d400968"
            ],
            [
                "fn",
                {},
                "text",
                "trst wqbvwerbwerb"
            ],
            [
                "n",
                {},
                "text",
                [
                    "wqbvwerbwerb",
                    "trst",
                    "",
                    "",
                    ""
                ]
            ],
            [
                "email",
                {
                    "type": "Work"
                },
                "text",
                "[email protected]"
            ]
        ],
        []
    ]
}

Do a lookup on OpenPaaS to get the associated email

# API to adapt but it looks like: (with the id instead of the mail)
curl -u "[email protected]:secret" https://backend.poc-mail-avocat.fr/api/[email protected]

and index the mail address onto the relevant user search database.

Updates needs to be handled too:

{
    "bookId": "65ae6175751dbd001b5799e8",
    "bookName": "contacts",
    "contactId": "fd9b3c98-fc77-4187-92ac-d9f58d400968",
    "userId": "65ae6175751dbd001b5799e8",
    "vcard": [
        "vcard",
        [
            [
                "version",
                {},
                "text",
                "4.0"
            ],
            [
                "uid",
                {},
                "text",
                "fd9b3c98-fc77-4187-92ac-d9f58d400968"
            ],
            [
                "fn",
                {},
                "text",
                "trst wqbvwerbwerb"
            ],
            [
                "n",
                {},
                "text",
                [
                    "wqbvwerbwerb",
                    "trst",
                    "",
                    "",
                    ""
                ]
            ],
            [
                "email",
                {
                    "type": "Work"
                },
                "text",
                "[email protected]"
            ]
        ],
        []
    ]
}

Definition of done

  • Names shall be used to set the mailbox display name of the recipient
  • When I send an email to someone it should not override the display name set by the calendar
  • Display name from the calendar should override the one of automatic indexing upon sending email (that likely to not have a display name)
  • Separate optional module, should share AMQP base configuration than Reflect calendar updates into twake mail #1162
@chibenwa
Copy link
Member Author

chibenwa commented Oct 4, 2024

We can use mock-http to emulate openpaas id => email resolution

$ curl -k -u "yyyy:xxx" https://openpaas.linagora.com/api/[email protected] | jq . 
[
  {
    "_id": "5f50a663bdaffe002629099c",
    "firstname": "Benoît",
    "lastname": "TELLIER",
    "preferredEmail": "[email protected]",
    "emails": [
      "[email protected]"
    ],
    "domains": [
      {
        "joined_at": "2020-09-03T08:16:35.682Z",
        "domain_id": "5f4ceb25f7422900594485de"
      }
    ],
    "states": [],
    "avatars": [
      "5f59c49c17edf70026566796"
    ],
    "main_phone": "0677260458",
    "id": "5f50a663bdaffe002629099c",
    "displayName": "Benoît TELLIER",
    "objectType": "user"
  }
]

http client can b implemented with reactor-netty.

Reactor-netty example https://github.com/apache/james-project/blob/master/third-party/rspamd/src/main/java/org/apache/james/rspamd/client/RspamdHttpClient.java

mock-server https://github.com/apache/james-project/blob/master/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/pushsubscription/PushServerExtension.scala

@chibenwa
Copy link
Member Author

chibenwa commented Oct 7, 2024

Sorry this was the call for mailAddress -> OpenPaaS userId

But what we want is OpenPaaS userId -> mailAddress

curl -k -u '[email protected]:mypassword' https://openpaas.linagora.com/api/users/5f50a663bdaffe002629099c | jq
{
  "_id": "5f50a663bdaffe002629099c",
  "firstname": "Benoît",
  "lastname": "TELLIER",
  "preferredEmail": "[email protected]",
  "emails": [
    "[email protected]"
  ],
  "domains": [
    {
      "joined_at": "2020-09-03T08:16:35.682Z",
      "domain_id": "5f4ceb25f7422900594485de"
    }
  ],
  "states": [],
  "avatars": [
    "5f59c49c17edf70026566796"
  ],
  "main_phone": "0677260458",
  "accounts": [
    {
      "timestamps": {
        "creation": "2020-09-03T08:16:35.682Z"
      },
      "hosted": true,
      "emails": [
        "[email protected]"
      ],
      "preferredEmailIndex": 0,
      "type": "email"
    }
  ],
  "login": {
    "failures": [],
    "success": "2024-10-04T12:59:44.469Z"
  },
  "id": "5f50a663bdaffe002629099c",
  "displayName": "Benoît TELLIER",
  "objectType": "user",
  "followers": 0,
  "followings": 0
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants