[contacts-manager-api] Preferred ContactField

Hi,

In the current specification, ContactField has an attribute "type" of type DOMString[]. It is documented that "PREF" should be present in the type array if this is the preferred value for this field (for .e.g. if a contact has several phone numbers or addresses).

This is inherited from vCard v3 format. I personally think this should be improved for several reasons:
a. The "preferred" state is not really a type
b. To find the preferred phone number (for e.g.), the client needs to iterate over the items in the "Contact.tel" array and for each of these ContactFields iterate through the elements in the ContactField.type array to find out if "PREF" is present. This is IMHO cumbersome and inefficient.
c. In the new vCard v4 format [2], PREF is no longer part of the type. It has now its own parameter:
TEL;VALUE=uri;PREF=1;TYPE="voice,home":tel:+1-555-555-5555;ext=5555

I see 2 potential alternatives:
1. Add a "preferred" boolean attribute to ContactField interface
2. Document that the first element in the array is always the preferred one

I have a slight preference for 2. because it is a bit easier to use and keeps the API simple.
Adding a boolean would work but it is only useful if there is more than 1 value in the array and we would also need to document that there can be only one element in the array with its "preferred" attribute set to True.

Any thoughts on this?

Kr,
Christophe DUMEZ

[1] http://tools.ietf.org/html/rfc2426
[2] http://tools.ietf.org/html/rfc6350

Received on Monday, 11 March 2013 21:26:06 UTC