Closed Bug 1883917 Opened 2 years ago Closed 10 months ago

Adding address book name in autocomplete result when using onSearchRequest listener

Categories

(Thunderbird :: Add-Ons: Extensions API, enhancement)

Thunderbird 115
enhancement

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: said-asma, Unassigned)

Details

Attachments

(1 file)

Attached image MultiLDAP.png

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:115.6) Gecko/20100101 Firefox/115.6

Steps to reproduce:

I'm working on an extension for TB v115 which return specific data in compose autocomplete.

I'm using this listener :

messenger.addressBooks.provider.onSearchRequest.addListener(async (node, searchString, query) => {
return {
isCompleteResult: true,
// Return an array of ContactProperties as results.
results: [{ DisplayName: "Test1", PrimaryEmail: "Test1@test.com"},
{ DisplayName: "Test2", PrimaryEmail: "Test2@test.com"},
{ DisplayName: "Test3", PrimaryEmail: "Test3@test.com"}]
};

}, {
addressBookName: "Test adressbook",
isSecure: true,
});

Actual results:

The result of autocomplete is displayed in this format : name <email adress> like the first capture

Expected results:

I would like to add the source adressbook name for each suggestion
exemple : name <email adress> -- source like the second capture

Can you check if setting the preference mail.autoComplete.commentColumn to 1 does what you request?

I checked the code and there is no easy way to implement an arbitrary comment value for the provider, because it does not implement an autocomplete provider at all. If flipping the pref does what you need, I tend to close this as WORKSFORME.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME

Hello John, yes, it works when I set the preference to "1", but it does not solve my problem because this feature allows me to set a single value as the address book name for all result addresses (display the field "addressBookName" defined as below) :

{
addressBookName: "Test adressbook",
isSecure: true,
}

, while my result addresses are coming from multiple addressbooks.

anyway thank you for the solution.

Hm. Ok.

Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: WORKSFORME → ---

Coming back to this after having rechecked, the code. I do not see how this could be implemented.

What I suggest instead is to register different listeners for the different "books" (I assume different remote sources) you are accessing. You do not have to check all sources within in the same listener, but can create dedicated listeners for each remote source. This will give you individual LDAP style address books, which all get queried and return their results with the correct address book name appended to the auto complete search results.

Status: REOPENED → RESOLVED
Closed: 2 years ago10 months ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: