In search for questions.

Content by Tyches.
Licensed under CC by.

Theme by nostrich, altered by Tyches.

18th July 2009

Text with 1 note

Syncing Notes via IMAP

In his latest essay about note solutions, John Gruber mentioned two ways to sync:

  • locally, via USB (Notes) or WiFi (Things)
  • remotely, via HTTP (SimpleNotes)

There is a third one. I’ve seen only a single instance of it implemented, and it is implemented in Mac OS X, but not on the iPhone.

It is IMAP.

This is precisely how Notes are synced across various Macs in Apple Mail. All it takes is some IMAP folder, and a few X-* headers. This solution:

  • leverages the IMAP protocol, which already solves a good deal of sync issues for the developper.
  • does not require a web service, just an implementation in the client to manage the headers correctly.
  • makes the content readable by any IMAP mail client, or even editable.
  • anyone can have its own IMAP server, or use one of its choosing. This mitigates or eliminates privacy issues, depending on trust.
  • could leverage PGP or S/MIME for more privacy, content control is in the hands of the user, not the server.

What’s more, those headers are fully readable by anyone and should be fairly easy to reverse engineer. One can see them straight in Mac OS X Mail.app by showing Raw Source (option-cmd-U) on the note.

Technically, the specific headers are very simple:

This one should identify the message as a note:

X-Uniform-Type-Identifier: com.apple.mail-note

This one should give the message creation date, probably for sorting or syncing:

X-Mail-Created-Date: 2009-04-11 12:57:37 +0200

This one should tell the client that subject is generated from the first line of the content:

X-Mail-Generated-Subject: YES

This one should be used to track notes during various syncs:

X-Universally-Unique-Identifier: 5ba16de5-6c6d-4e9e-a24e-09aaa2b9cfd8

I just wonder why Apple’s iPhone Notes.app doesn’t use this mechanism. It could leverage iPhone Mail.app settings for that, especially together with MobileMe. It just feels weird for them to fall back on USB sync for that. Well, maybe they’re working on it. I also wonder why no notes app developer ever thought of using this, providing him with instant sync with Mail, and graceful fallback on many desktop and web apps without the hassle of having to provide a web service. Well, barring having to implement IMAP that is. The only downside is that it does not go through HTTP and thus could be blocked by some firewall/proxy.

When you come to think of it, this could be used by many apps, just not Notes.

  1. leoline-wright reblogged this from f-utility
  2. f-utility posted this