Closed Bug 438333 Opened 16 years ago Closed 16 years ago

Make determining which address books to search on autocomplete a lot easier

Categories

(MailNews Core :: Address Book, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(1 file)

Attached patch The fix (deleted) — Splinter Review
Currently in nsAbAutoCompleteSession we first of all find out if local autocomplete is enabled, then we also look to see if we need to search any replicated (cached) LDAP directories, then we iterate through all the local directories, before finally getting the last replicated LDAP directory. There is currently an attribute in nsIAbDirectory: searchDuringLocalAutocomplete Currently, this returns true for an address book type, apart from LDAP which returns false. I want to change this to: boolean useForAutocomplete([optional] in ACString aIdentityKey); The intention currently is that: 1) local directories (mork/outlook/os x) will return the value of mail.enable_autocomplete 2) remote directories (ldap and any others that come along) will return false when they are online, and true when they are offline and data is available. Although the existing code can't use the identity key, when implementing the next step of bug 370306 I will hook it up, so that the correct offline cache will be used i.e. match the online address book with the offline version. With this new function we'll be able to iterate through the directories and query each one in turn. The only disadvantage I see is that we'll be getting the mail.enable_autocomplete pref n times as opposed to once. It is a shame I'm having to change the old autocomplete code, but it seemed the easiest way to make the new code clean from the start. There are two things I'm expecting to happen at some stage in the future which is why I want to implement this interface in this manner: 1) GetChildCards and the other search functions will be replaced by some async/sync generic method of getting the cards. 2) Fixing bug 125188 (specify which directories and ABs) This API change now would mean that we could do this without having to change the API again (just the documentation).
Attachment #324447 - Flags: superreview?(neil)
Attachment #324447 - Flags: review?(neil)
Comment on attachment 324447 [details] [diff] [review] The fix >+ * Whether or not the directory should be searched when doing autocomplete, >+ * *by using GetChildCards*. Currently LDAP does not support this in online The *s look odd... perhaps something like this: (currently by using GetChildCards); LDAP does not support this >+ boolean useForAutocomplete([optional] in ACString aIdentityKey); All of our "real" callers will "have" a key, so no need for it to be optional. >+ PRBool useForAutocomplete; >+ rv = directory->UseForAutocomplete(EmptyCString(), &useForAutocomplete); > NS_ENSURE_SUCCESS(rv, rv); >+ >+ if (!useForAutocomplete) > return NS_OK; This won't work for kAllDirectoryRoot. r=me with this fixed. >+ searchedDirs = PR_TRUE; Hmm, maybe call this didSearch?
Attachment #324447 - Flags: superreview?(neil)
Attachment #324447 - Flags: superreview+
Attachment #324447 - Flags: review?(neil)
Attachment #324447 - Flags: review+
Checked in with nits addressed. For testers, there should currently be no change to the existing autocomplete functionality. Local searches and offline LDAP searches should work as they did before this patch.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Flags: in-testsuite+
Target Milestone: --- → mozilla1.9
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: