Contact Conversion Rewrite
I finally finished rewriting the code to convert contacts as it was overly complicated and some code was duplicated a few times. Along the way I was greeted with an error message I’ve never seen:
Error: XML descendants internal method called on incompatible Object
The cause: I put two periods where only one was needed..
I previously mentioned that copying or moving a card would make it lose the attributes added by this extension, but this is now fixed. It does slow down copying and, more noticably, moving cards, so there is a new preference to disable this.
Miscellaneous Bug Fixes
I’ve been searching for bugs to fix and found a few. Not all of the preferences worked, but I think they should be fixed now. The Home section of the card view was sometimes visible when none of the relevant attributes were present, as well, due to a mistake I made in the overlay.
While working on overriding the method to copy/move cards, I crashed Thunderbird by calling the deleteSelectedCards method of the address book view when no cards were selected. After using gdb to look at the backtrace, I found that calling nsIAbMDBDirectory::DeleteCards crashes if null is passed to it. I wrote a unit test and patch, but I am installing FreeBSD and compiling Gnome and it’s dependencies on my slow laptop (on which I test patches in Windows), so I have not tested the patch or test in Windows yet.
Removing the Auth Token
I have now added and tested a button to remove the auth token on the first tab of the extension preferences. If you ever wish to remove the extension, I suggest you remove the auth token. Additionally, if you are getting authentication errors, remove the auth token, close the Address Book if it was open, and re-open the Address Book to sign in again.
After receiving a comment on a previous blog post, I added some preferences and redesigned my preferences dialog.
It now has three tabs: Main, Extended, and Address. The wording and layout of the preferences will probably change, but any feedback is welcome.
All of the main preferences.
- Name of the Address Book – The name of the Address Book that is synced. The default is Google Contacts. You should synchronize contacts before changing the name, and you will have to delete the old one if you want.
- Synchronize Interval – The length of time, in minutes, between automatic synchronizations. The default is 30 minutes. (Note: The screenshot was taken when this was still in milliseconds)
- Initial sync delay – How long the extension should wait after the Address Book is opened, in milliseconds, before synchronizing.
- Always update Google during conflicts – Check this if Thunderbird should have priority if a contact changes in Thunderbird and Google Contacts.
- Confirm before deleting duplicates – Check this if you would like to be prompted to delete each “duplicate” that the extension finds. Recommended.
- Sync extended properties – Check if you would like more properties (like Department, FirstName, LastName, NickName, etc.) synchronized. They will not be visible from Google Contacts. The next section explains this in more detail.
The extended properties to synchronize. As explained before, they are not visible from Google Contacts, but they are visible from the New and Edit Card dialogs. Leave the last few blank if you don’t want to synchronize 10. The last checkbox on the previous tab (Main) must be checked to sync these properties.
This tab determines how addresses are synchronized. As explained in a previous post, Google only has one field that allows multiple lines for addresses while Thunderbird has 6: Address, Address2, City, State, ZipCode, and Country. My solution is to separate different attributes in Thunderbird with a newline character. You can choose up to 6 attributes to sync. Don’t include Home or Work in these. Valid choices are limited to Address, Address2, City, State, ZipCode, and Country. If you type something else it will not sync. If you do not want any or all attributes synced, leave blank line(s) at the end.