Archive for February, 2009
Since I finally got around to learning PHP, I decided to create a quick and simple online tool for viewing your Google Contacts. It naturally supports the extra attributes that gContactSync uses (except allow remote content and preferred mail format since those aren’t too important).
My intention was just to make an easy way to view your synchronized Thunderbird/Google contacts from anywhere with Internet access with the ability to show the custom attributes added by gContactSync. If you don’t use gContactSync you are better off using Gmail’s better-looking interface. 😉
It is read-only (you cannot update, delete, or add contacts or groups) for now.
You can find it here. Click on the Login button to be redirected to a page from Google. If you are already signed into a Google Account then you can click on a button to grant access to your contacts for pirules.net (my website).
If you choose to grant access, a token is stored and matched with a cookie on your computer so you only have to sign in once. This token can be used to access your contacts by retrieving, updating, adding, or deleting contacts and contact groups but your username and password cannot be obtained or modified using this token. You can read more about this authentication method (called AuthSub) here.
You will be redirected back to pirules.net where the one-use token is exchanged with a multi-use token (still only for contacts). Then, your groups and the first 25 contacts will be obtained. Click on a group (left side) to show the contacts in it and click on a contact to view more details. Everything is on the same page right now and contacts are obtained using AJAX so the entire page is not refreshed until you logout.
Only 25 contacts (for now) are shown at a time so there are links to the previous and next 25 contacts, if applicable, at the bottom of the list.
Click the Logout button when you are finished, which will de-activate your token unless you want it to remain valid for future use on the site. Logging out takes a few seconds before giving any feedback.
As a sidenote, if it doesn’t work try waiting for 10 or 15 minutes before letting me know because I am actively working on the page and sometimes make mistakes. I just caught a nasty virus (which ruined my first day off), so I may be slow to reply.
- Cookies enabled for pirules.net (only needed until the page or browser is closed)
- Firefox 3.0.6 or higher (tested with a fairly recent build of Shiretoko 3.1b3pre and Firefox 3.0.6). It does not work in Internet Explorer 6, 7, or 8 right now, and it might not ever since I spend a lot of time at work making a website IE-compatible and it is neither fun nor easy. I’m guessing anyone that uses this already uses Thunderbird and Firefox, but if that isn’t the case let me know and I’ll see what I can do.
gContactSync 0.2 takes advantage of Google’s updated and improved API for obtaining and modifying contacts. Duplicates are allowed which, combined with a rewrite of the synchronization code, provides a significantly faster synchronization process. The longest delay now seems to be receiving the contacts from Google. There may be some room for improvement there, but I do not want to make too many changes yet until I make sure that the ones I made did not introduce any bugs.
The new API exposes the system groups, which include My Contacts, Family, Friends, and Coworkers. All contacts from the account, including Suggested Contacts are in the synchronized address book. There is a mailing list for each of the pre-defined system groups and each custom group.
You can download it here, but I rewrote the most important code and there may be bugs I haven’t found in it yet. I would only advise those who have hundreds or thousands of contacts and receive the “Unresponsive Script” warning to try it. Please read the upgrade instructions below.
NOTE: Google allows contacts without e-mail addresses, but Thunderbird will break if a contact without an e-mail address is manually added to a mailing list as explained in Bug 20153. If you encounter that bug in 0.1.x please let me know because it is somewhat difficult to fix and all attempts to synchronize after it breaks will fail. To avoid this, 0.2 adds an email address “firstname.lastname@example.org” to any contact without one. However, only unique e-mail addresses are allowed in mailing lists, so only one contact with an empty e-mail address is allowed per group/mailing list is allowed until o.2.0b1. The other contacts will appear in the address book only.
- All the features of 0.1
- Duplicates (multiple contacts with the same e-mail address) are allowed
- Much faster synchronization
- Only US English (en-US) until I finish adding features and strings
- Customization of how addresses are synchronized
- Default groups are enabled (Family, Friends, Coworkers) as mailing lists in Thunderbird
- Thunderbird 2.0 or Thunderbird 3.0 (a1pre through the trunk build b3pre) or Seamonkey 2.0 only (not 1.1.x)
- A Google account or Google-hosted account
- An Internet connection faster than dialup (DSL, cable, satellite, etc)
- More locales
- Maybe addons.mozilla.org?
- Let me know what else you would like, but I can’t promise anything
Upgrade instructions to 0.2.0
- In the address book, synchronize contacts one last time.
- Rename the synchronized address book(s), this is just so you have a backup of your contacts.
- In the main window, go to Tools -> Add-ons -> gContactSync -> Options/Preferences
- In the Accounts tab, select one account at a time in remove them.
- Install the new version and restart Thunderbird. There is no need to remove the previous version first.
- Open the Address Book window and fill in the information for your first account.
Bugfixes/enhancements from 0.1.x
- Bug 20527 – Avoid HTTP Request errors when the Address Book window is closed
- Bug 20509 – Add Seamonkey support
- Bug 20508 – Consider adding overlay.css to customizeToolbar.xul
- Bug 20487 – Add shortcut to preferences in the Address Book
- Bug 20486 – Improve Address Preferences
- Bug 20352 – Update gContactSync to use Contacts Data API 2
- Bug 20148 – Default groups dont appear in Thunderbird
- Bug 19786 – Support for Google’s ‘Most Contacted’ & ‘Suggested Contacts’
- Bug 20153 – Partial fix only – Groups containing contacts without email addresses break in Thunderbird
Google and Thunderbird store postal addresses differently, so converting one format to the other is difficult. Google’s fields have multiple lines while Thunderbird has 6 separate fields. gContactSync 0.1 would take Thunderbird’s 6 address fields (Address, Address2, City, State, Zip Code, and Country) and convert them into a new field that allows multiple lines like Google when a new contact from Thunderbird was first synchronized. Contacts from Google would have their addresses directly synchronized with the new fields in Thunderbird. However, it converted them in a hard-coded format (the standard US format) and removed the values in the old fields unless a hidden preference was changed.
0.2 will have a new preferences tab, probably similar to the screenshot below that allows for customization of how addresses are converted.
As you can see, you can customize how each address is created by placing the name of the property in brackets. Anything not in brackets, such as spaces or punctuation, is preserved.
You can find the properties used by Thunderbird here.
Here is the default for the home address, which is identical to the previous hard-coded method.
[HomeCity], [HomeState] [HomeZipCode]
Lines that contain no letters are numbers are removed, so a contact with a HomeAddress and HomeCountry only will have two lines.
I’m going back home for the weekend so I won’t get much done with this over the weekend, but I would like to hear some opinions about how this looks and works. If you don’t fully understand how it works from the description please let me know so I can make it more clear for you and everyone else.
I don’t have a version tested thoroughly enough and won’t for at least a week. The newest source is in the CVS repository.