Adding Exchange Server contacts to the address book
The main culprit is that the address book implementation seems to require that directory objects also derive from nsRDFResource. The underlying interface nsIRdfResource has the non-scriptable method GetValueConst, which is used by core Mozilla code in accessing RDF items. Perhaps I could have figured out how to work around this, but given the work I had already done in SkinkGlue, it seemed easier to just add a SkinkGlue type that allowed me to create an nsIAbDirectory object. Another advantage of this is that I could take advantage of the existing full generic C++ implementations, and then only override methods that I needed to change.
For address book cards, this was not necessary. There is an existing object “@mozilla.org/addressbook/cardproperty;1″ which works just fine.
The result is that the standard Exchange Server “Contacts” folder and subfolders appear in the Thunderbird address book:
Note this is a Mork-free implementation, unlike the mailnews SkinkGlue objects.
Since the address book interface does not support a tree of directories, I had to implement the subfolder “Test subfolder” as a top-level address book with an extended name.
I hope to demonstrate this publically soon by adding “address book” support to my TweeQuilla Twitter extension, where an address directory would be interpreted as a list of followers.
Changes needed to Address Book to make this easier
The address book interfaces are much cleaner on average than the mail interfaces, but unfortunately not completely there yet. What would make this easier to do?
1. Remove address book dependencies on RDF
2. Add async access capability to key interfaces
Most new address book accounts that might be supported would be remote sources. While the existing LDAP implementation manages to work around that, it is not at all clear from the interfaces how this is done. Really async access needs to be thought through and applied consistently. In my implementation, I essentially end up loading all of the contacts into memory, which will not scale well to large implementations.