Rohit's Realm

// rohitsrealm.com / archive / 2007 / 04 / 18 / synchronizing-gmail-contacts

April 18, 2007

Synchronizing Gmail Contacts

I hate to disappoint those readers who have become accustomed to reading my angst-ridden entries of late (I swear I am not in high school still!), but I thought I would take a (brief) break from contemplating suicide to discuss a topic that is likely just as uninteresting for the majority of readers: how do I synchronize my Gmail contacts with my CrackBerry™?

As most avid readers know, I recently made the switch to Gmail and all in all have been very happy. I like the novel concepts introduced by the Gmail UI quite a bit, especially labels and mail archiving. Using Gmail as my primary e-mail account, however, does have its problems. Since I no longer have programmatic access to my address book, keeping my contacts synchronized has become a major pain. I'm currently maintaining three separate repositories of information:

  1. My Gmail contacts;
  2. The BlackBerry address book (which syncs with my work e-mail)1; and
  3. A LDAP store on my home server (which should technically be definitive, but is not).

Obviously, manually synchronizing all three of these address books is not only incredibly tedious, but ultimately unsustainable. Some quick research—and by that, I mean 2 minutes spent Googling (is that even a word?)—revealed no definitive solution for my problem. Enter the (mostly marginalized) computer scientist in me (one would hardly be able to guess I was once an EECS major at Berkeley, considering what I do nowadays).

More research (i.e., another 2 minutes), and I think I might have a solution. Non-nerds, please feel free to ignore the rest of this post. Nerds, read on, and tell me if I'm on (metaphorical) crack.

The Proposed Solution

First of all, since LDAP is the de facto standard for representing contact information (inetOrgPerson, anyone?), it seems to me that using a LDAP directory as the definitive source of data makes the most sense. Now, most people will probably reject this suggestion for one of two reasons: (1) Running an LDAP directory is not an option for the common person; or (2) LDAP sucks. To the first point, let me just say: when have I ever proposed a solution, technical or otherwise, that is suitable for the unwashed masses? To the second point, I completely agree, but LDAP is a necessary evil in life; deal with it, you petty assholes.

With a LDAP directory, the problem of synchronizing the smartphone is solved. Commercially available software has hooks for LDAP directories, and I'm sure there is some open source equivalent (though I did not bother to look). The only problem that remains is synchronizing Gmail with the central LDAP store.

That is where XMPP, the protocol used by Gtalk, enters the picture. Now, I have absolutely no experience with XMPP (I had not even heard about it until yesterday), but it seems to me that if I can add and update contact information through any Gtalk client (which operates on the same data as Gmail), then I should be able to implement this functionality using an XMPP library (e.g., Net::XMPP). Then, all that is needed is a Perl script that glues Gmail (via Net::XMPP) to the LDAP directory (via Net::LDAP). Voilà! A complete , easy to implement2 synchronization solution!

So what say you fellow nerds? Is this a viable solution? Have I missed a much easier solution that is already out there? Should I be spending my next weekend holed up learning about the intricacies of XMPP?

1 Clearly, synchronization with my work e-mail presents other problems and has major potential to introduce unresolvable conflicts. If I made more money, I think I would consider getting both a work 'berry and a personal 'berry to avoid this problem. Though it would mean carrying around two devices, I think the separation between work and life would be worth it. As of now though, I'm not spending $200/mo. on cell phones.
2 2-way synchronization is never easy to implement.

Comments

If there is an answer, it's on lifehacker.com

Good call. Lifehacker does have some stuff, but nothing that could solve my specific problem. The search continues...

So why can't you just write a perl script to login to gmail, download your contacts as csv and import?

-D

You mean, just use Gmail as the definitive source of data, and import into the 'berry? That could work, though reverse synchronization (from the 'berry to Gmail) could get messy.

I know this bloggpost was written a long time ago and that some form of solution presented itself or the quest for a way to sync Gmail contacts with mobile devices or other clents using LDAP was abandoned.

Anyway I wanted to bring to you attention that we are many gmail users trying to impress onto the Gmail Developer Team that many users want a nativ LDAP API to sync Gmail contacts. Check out this link to a google groups thread and help us to make this feature a reality.

Thank You!

Sorry. Correct link:
http://groups.google.com/group/gmail-labs-suggest-a-labs-feature/browse_thread/thread/ee127661cc3a2c73

Add Comment


 


 


 


 


* required field

E-mail addresses will never be displayed. The following HTML tags are allowed:
a abbr acronym address big blockquote br cite del em li ol p pre q small strong sub sup ul