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.

22 thoughts on “Thunderbird Sync With iPhone/iPod touch

  1. Pingback: Thunderbird Sync With iPhone/iPod touch

  2. 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.

  3. 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~

  4. I am looking for a solution to access USB mass storage from an iPhone app. Can you (or someone else) help?

  5. 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~

  6. 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.
    ;)

  7. 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.

  8. 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.

  9. Pingback: From outta Schilcher-Country

  10. 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.)

  11. Tith ref to Mr Zeroś post

    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.

    I did manage to set it up, however I see the following problems
    1. zindus does not sync the new OE Contacts address book with my Gmail account
    2. Although I can see the address in the OE address book, I cannot search for any contact.

    I would appreciate if Mr Zero could further clarify. I also saw this page which explains how to sync Tbird with OE
    http://kb.mozillazine.org/Usin.....zilla_Mail

  12. Hi,

    Search of OE contacts in Thunderbird adressbook *does* work, if these Contacts actually come from OE (WAB) using *outlook* contacts (registry patch useOutlook=1).
    Funny.

    Still, same bad performance for search in TB.
    Tips from http://kb.mozillazine.org/Long.....dress_book do not seem to help, though my Thunderbird 2.0.0.21 – indeed is creating these false entries.

  13. Hi Philip,

    Thanks for your post. I’m having trouble getting search to work. How do we set this up for the contacts to come from OE but use Outlook contacts? In other words, how do we do “registry patch useOutlook = 1″.

    Cheers,

    Ian

  14. Pingback: Foxmask (foxmask) 's status on Wednesday, 09-Sep-09 05:14:12 UTC - Identi.ca

  15. It’s now 2011. Following Mr. Zero’s solution didn’t work for me. Thought I’d share my experience in case anyone else is referring to this informative post.

    I’m using Thunderbird Portable 3.1.7. (Thunderbird and all data resides on my external USB drive. The prefs.js file is located at …\PortableApps\ThunderbirdPortable\data\profile\prefs.js.)

    Two notes from my own experience.
    1) Always a good reminder to back up your prefs.js file before you go to work on it.
    2) The reason for comment number (1) is that the first time I added the 3 lines of preferences in prefs.js I did so by inserting lines in the section where there were other ldap_2 entries. After saving and restarting Thunderbird, it came up blank … no email accounts, no contacts…nothing. When I went back to the prefs.js file, there were no entries after the point at which I had inserted them (basically all entries that came later in the alphabet). So it was good that I had a backup. Restoring the backup prefs.js file returned everything to as it was before.

    BTW I also tried just adding the entries in Mr. Zero’s post at the end of the prefs.js file, but these were completely ignored (i.e. no OE contact account created) AND when I went back to look at the prefs.js file again, the OE entries had disappeared.

    So presently, it would appear to me that this fix does NOT work for ThunderbirdPortable 3.1.7. I have a funny feeling its because Outlook Express is not on my USB drive.

  16. In the ‘plain’ Thunderbird 3.1.9, it is still possible to use Mr Zero’s solution, but the settings have to be entered into the about:config settings window, one by one, as prefs.js will really be ignored. In Thunderbird 1.5 or later, about:config is accessed via “Tools -> Options -> Advanced -> General -> Config Editor (button)”. New settings can then be added by right clicking on any elements of the list. It may be important to know, that for the second option, an Integer/Number type of variable has to be created.

Leave a Reply

Your email address will not be published. Required fields are marked *

Connect with Facebook

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>