Adding address book name in autocomplete result when using onSearchRequest listener
Categories
(Thunderbird :: Add-Ons: Extensions API, enhancement)
Tracking
(Not tracked)
People
(Reporter: said-asma, Unassigned)
Details
Attachments
(1 file)
|
16.61 KB,
image/png
|
Details |
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
Comment 1•2 years ago
|
||
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.
Updated•2 years ago
|
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.
Comment 3•2 years ago
|
||
Hm. Ok.
Comment 4•10 months ago
|
||
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.
Description
•