Thunderbird Sync With iPhone/iPod touch
I’ve gotten quite a few emails over the past several months from people who want to know how to sync their iPhone (or iPod touch) with Thunderbird. Quite a few are disappointed to find mozPod doesn’t support these newer devices. It’s not quite my fault as I’ve yet to see any indication that it’s practical to implement.
I should note I do not own either device, but from what I’ve read, it doesn’t matter. Hopefully by 2nd or 3rd generation when I’m on the market Apple will have come to their senses.
The problem is that Apple hasn’t provided a good method for anyone to provide sync with the iPod. Even on older devices it wasn’t pretty, but it was workable. There is no real sync API outside of iSync, which is Mac only and not a public API. Instead what was done is mount the iPod file system and send it your data. While not awesome, this has been workable and provided many Thunderbird users with mobile data.
On the iPhone and iPod touch it’s not even possible to easily mount the filesystem. The best method I’ve heard of is hacking it so you can mount your phone using sshfs with something like FUSE. I know myself and some Linux and Mac users (horray for MacFUSE!) could manage, but I wouldn’t dare try to explain to someone how to do that. From what I’ve read the iPhone manages data using SQLite 3. Therefore it seems possible to use mozStorage to interface with it. Perhaps someone with more experience with mozStorage and db’s generated outside mozStorage would know better about any potential compatibility issues.
Calendar:
/var/root/Library/Calendar/Calendar.sqlitedb
Address BookL
/var/root/Library/AddressBook/AddressBook.sqlitedb
/var/root/Library/AddressBook/AddressBookImages.sqlitedb
Seems to me Apple could turn this into an API pretty easily by re-creating the old iPod style USB storage device mounting and give us access to these files.
In my mind the ideal implementation would be for Apple to just have a iTunes embed a mini web server locally accessible (obviously) and create a REST API to work with all data on the device. That would open up a whole new way of interacting with the device. Essentially you would interact with 127.0.0.1:[port#] and GET/POST your way through the interface. Perfect for Calendar, Address Book, Notes, or whatever else Apple comes up with.
To get a vCard for someone:
GET /contact/vcard/?last_name=Jones HTTP/1.1 Host: localhost User-Agent: mozPod/0.3
vcard can also be done as XML (ooh DOM parsing for iPhone!), so there’s lots of possibilities.
To add a contact:
POST /contact/add/ HTTP/1.1 Host: localhost User-Agent: mozPod/0.3 Content-Length: 450 Content-Type: application/x-www-form-urlencoded fname=John&lname=Doe&address=1%20Large%20Road...
Though it would likely make sense to go with a more vcard like naming structure.
For calendar iCalendar or vCalendar would make most sense:
GET /calendar/ical/?start=1-1-1970&end=1-19-2038 HTTP/1.1 Host: localhost User-Agent: mozPod/0.3
You get the idea. Dead simple access. You could then use something likecurl to manipulate the iPhone’s address book via your existing application. It would be only accessible locally, so it’s as secure as your system. It would actually make things more secure since it would be one less reason for tinkering on the actual device, and it would open up a whole new market of iPod/iPhone software to go with all those accessories that have helped boost Apple’s market share. SyncML is cool, but SyncML is also a beast and reminds me of SOAP, WSDL etc.
Tags: api, Apple, fuse, iphone, ipod-touch, isync, itunes, macfuse, Mozilla, mozPod, mozstorage, sqlite, sync, Thunderbird






January 21st, 2008 at 5:50 pm
[...] The funniest thing at the Crunchies wrote an interesting post today onHere’s a quick excerptThe problem is that Apple hasn’t provided a good method for anyone to provide sync with the iPod. Even on older devices it wasn’t pretty, but it was workable. There is no real sync API outside of iSync, which is Mac only and not a … [...]
January 22nd, 2008 at 12:26 am
What about trying the free myFUNAMBOL site and using the open source Funambol iPhone plug-in and the Funambol Thunderbird plug-in?
Cheers,
fabrizio
January 23rd, 2008 at 7:14 pm
Why would you want that implemented via HTTP? That just seems so… retarded to me. Someone who doesn’t really know how to do anything asking that they use something he’s familiar with so that he’d be capable of using it.
Also, it’s just too much complexity… you’re dependent on like fifty extra APIs, as well as making sure you keep iTunes running… It just doesn’t make sense.
I’d rather see it implement something like a real database API that hooks directly to the USB device, so it can respond to SQL style queries. Probably hella complicated on the hardware side though… There’s probably a better idea than that. (Maybe it’d be easier to just make a software library that can read the files directly via USB mass storage, and give you database style output/input)
I’d like it to implement the database on the device itself though for peer to peer sync possibilities… Think about it… you could see your library on the dash in your car stereo, or on your TV, and navigate it from there as easily as on the device proper. Via bluetooth, though, most likely not USB. This is where it’d have been nice if Firewire had won the high speed interface wars, it was peer to peer, meaning that each device was responsible for itself, and could send data on the wire without needing a computer.
April 6th, 2008 at 11:10 am
Use plaxo!
June 9th, 2008 at 7:01 pm
Now that the new 3g iPhone has been announced, with the iphone 2.0 updated AND the SDK that’s out, do you believe that building an application to sync thunderbird , calendar , will be as difficult? Or even doing the same thing on a jailbroken iphone?
Would be great to hear your thoughts on it. That’s the one reason I’m not going to get an iphone, 2/3g, because it won’t sync on my pc with anything other than microsoft entourage.
Rocksteady,
Danno~
June 9th, 2008 at 9:50 pm
@Danno: See my WWDC 2008 Analysis
July 12th, 2008 at 11:44 pm
I am looking for a solution to access USB mass storage from an iPhone app. Can you (or someone else) help?
July 13th, 2008 at 8:53 pm
I have read it and i guess i can’t really tell what would be the answer to my previous question above.
You think yes? No? I’m Lost
Rocksteady,
Danno~
August 10th, 2008 at 10:19 pm
In regard to syncing contacts between Thunderbird and iPhone there’s a workaround that seems simple enough to be practical. Though iTunes doesn’t care to sync with Thunderbird it will sync with the Windows Address Book. Of course one of the reasons we’re using Thunderbird is to avoid using MS Outlook or OE, but there’s no reason not to make use of the WAB (which in addition to iTunes will also sync with many other apps). The trick here is to have Thunderbird use the WAB as it’s primary address book and then have iTunes sync the iPhone with the WAB. To do this close Thunderbird and add these few lines to the prefs.js file found in the profiles folder:
user_pref(”ldap_2.servers.OE.description”, “Outlook Express”);
user_pref(”ldap_2.servers.OE.dirType”, 3);
user_pref(”ldap_2.servers.OE.uri”, “moz-aboutlookdirectory://oe/”);
Once done open the Thunderbird Address Book and you’ll find an OE Contacts address book. I then simply moved all my Personal Address Book contacts into the new OE Contacts (or whatever you decided to rename it) address book and now maintain them there. All Thunderbird contact fields are supported and contact entries can easily be added, edited and deleted from within the Thunderbird Address Book. Now you can set iTunes to sync with the Windows Address Book and your iPhone and Thunderbird contacts will forever on be in sync.

September 10th, 2008 at 5:59 am
Re Mr Zero’s post - I just did a Google Desktop search for the prefs.js file and came up with five candidates, none of them named prefs.js. I am running Thunderbird 2.0.0.16. Which prefs file are you referring to? Also my install of iTunes (7.7.1) doesn’t show WAB as an option for synching the Calendar, just Outlook. Any ideas? I am running XP Home, Service Pack 3.
September 10th, 2008 at 8:55 am
The prefs.js file ought to be in the following location:
Documents and Settings\[username]\Application Data\Thunderbird\Profiles\[xxxxxxxx].default
Application Data is a hidden folder so be sure you have explorer set to “Show hidden files and folders” or you will not be able to browse to the above location.
In regard to selecting the WAB as a sync option, I’m using iTunes 7.7.1.11 and “Windows Address Book” appears as an option in the “Sync contacts with” dropdown menu.
September 13th, 2008 at 8:54 pm
I-Phone Synchronisierung mit Thunderbird und Google Calendar, Teil I…
Eigentlich.Eigentlich weiß ich ja nicht, wieso ich mich immer mit so Dingen beschäftige. Eigentlich habe ich kein I-Phone. Eigentlich hab ich noch keine Notwendigkeit gesehen, Kontakte und Kalendereinträge zwischen einem Computer und einem Mobilte…
September 14th, 2008 at 3:40 am
Syncing Thunderbird contacts with iPhone:
- Download and install the Zindus extension for Thunderbird, and sync Thunderbird contacts with Google Contacts
- In iTunes, select the iPhone device, and under Info “sync contacts with Google Contacts”
You can have Zindus sync with Google automatically on a regular basis, or manually sync by selecting Tools>Zindus>Sync Now in Thunderbird.
(if you want to replace iPhone contacts entirely with your Thunderbird contacts on the first sync, in iTunes go to Edit>Preferences> and find the tab with the option to reset Sync history. Then click on the iPhone device in iTunes, and under “Info” select the “Replace information on this iPhone” “Contacts” tab.)