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~