aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--importAddrBook.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/importAddrBook.js b/importAddrBook.js
index 83256c4..1cb390c 100644
--- a/importAddrBook.js
+++ b/importAddrBook.js
@@ -201,6 +201,21 @@
}
}
+ // Per RFC 4519 section 3.12 cn and sn attributes are always
+ // required
+ if (! contact.hasOwnProperty('name')) {
+ if (contact.hasOwnProperty('familyName') &&
+ contact.hasOwnProperty('givenName')) {
+ contact.name = contact.givenName + " " + contact.familyName;
+ }
+ else if (contact.hasOwnProperty("org")) {
+ contact.name = contact.org;
+ }
+ else if (contact.hasOwnProperty("jobTitle")) {
+ contact.name = contact.jobTitle;
+ }
+ }
+
console.log("contact:\n" + contact.toSource());
if (Object.keys(contact).length > 0) {
var outObj = new mozContact();