Contacts in the Browser - 0.2 released

03-31-2010

Firefox Contacts 0.2 has been released! This is mostly an infrastructure upgrade release; the database schema was changed to support a more dynamic way of interacting with contact services. I also added support for Portable Contacts, Webfinger and HCard import, which bring the "web of contacts" much closer to reality.

Contacts 0.2 - Tech Overview

Database

We made a big change to the database schema for this release. In 0.1, we combined data from multiple services into a single document and saved that into the database. While that made it simple to read, we had no ability to remove data from just one service, or to see where data had come from.

In 0.2, we save all the data from each service, with a service name label. These documents are flattened into a single record when the object is read, instead of when it is written. That means we can remove and refresh data on a per-service basis.

Old system:

{
  documents: {
    default: {
      displayName: "John Doe",
      name: {
        given: "John",
        family: "Doe"
      },
      emails: [
        {type: "work", value: "john@work.com"},
        {type: "home", value: "john@home.com"}
      ]
   }
  }
}
New system:
{
  documents: {
    gmail: {
      name: {
        given: "J",
        family: "Doe"
      },
      emails: [
        {type: "work", value: "john@work.com"},
      ]
   },
    native: {
      displayName: "John Doe",
      emails: [
        {type: "home", value: "john@home.com"},
      ]
   }
}

With this new capability in the database, we were able to add these new features:

  • Per service "refresh" and "disconnect"
  • In the Contact View pane, a "where did this data come from?" view
  • A per-service refresh timestamp

Importers

Two new importers were finished for this release: LinkedIn and Plaxo.

The LinkedIn importer is a bit complicated since LinkedIn has a CAPTCHA for contact downloads. We spent some time trying to get the CAPTCHA flow into the Contacts user experience but didn't get it working -- so we are taking advantage of the fact that LinkedIn uses a server-side validity timer for the CAPTCHA. So the user has to answer the question, then import the link again. Messy and not very satisfying but it does work.

Plaxo is a technically interesting case because Plaxo is a pure Portable Contacts provider. We implemented a Generic Portable Contacts import module, and the Plaxo module is a trivial subclass of that.

We fixed some international character issues in the Mac Native address book importer by going to UTF-16 everywhere.

Discoverers

The Discoverer system was completed for this release. A discoverer has a simple API that takes a person and returns a record of new data about that person. We wrote a number of discoverers to demo the system:

  • Webfinger: The webfinger protocol allows for lookup of a service directory for a user from an email address. We follow the procedure and create one or more "url" records, annotating each with the "rel" of the link.
  • HCard: The HCard specification is a microformat to embed contact information in a webpage. We use the Firefox built-in implementation of HCard to parse the entire page and grab the embedded data -- and, FYI, we made a decision to only grab links that have a "rel" of "me". To decide which links to examine for HCard data, the discoverer scans the "urls" list for links with a "rel" of http://microformats.org/profile/hcard and loads those.
  • Yelp, Amazon, Flickr, and Gravatar: These are all simple search-by-email lookups. In each case, the site exposes a propietary search URL, which we query with each of the user's emails.

Contacts View

Relatively simple changes to the contacts view in this release. The most interesting new bit is the "Where did this data come from?" view, which just exposes the data structure we create in the database schema change. Also, lots of fiddly CSS changes to get the vertical heights right everywhere.

Email Autocomplete

Other than changes to support the new database, the only change in the auto-completion module was support for more than one email address per contact, which was a much-requested feature.

blog comments powered by Disqus