Bug 1588970 - Stop address book UI reporting many errors. r=mkmelin
authorGeoff Lankow <geoff@darktrojan.net>
Wed, 16 Oct 2019 15:34:18 +1300
changeset 37164 14258a1ca363e616e973e31b5cadaa7bd995cd5f
parent 37163 7fc4bc60717ae9956315068405022e2209501967
child 37165 bda10e8030ef9f048932f072ceff19142f942749
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersmkmelin
bugs1588970
Bug 1588970 - Stop address book UI reporting many errors. r=mkmelin
mailnews/addrbook/jsaddrbook/AddrBookCard.jsm
--- a/mailnews/addrbook/jsaddrbook/AddrBookCard.jsm
+++ b/mailnews/addrbook/jsaddrbook/AddrBookCard.jsm
@@ -163,17 +163,17 @@ AddrBookCard.prototype = {
   getProperty(name, defaultValue) {
     if (this._properties.has(name)) {
       return this._properties.get(name);
     }
     return defaultValue;
   },
   getPropertyAsAString(name) {
     if (!this._properties.has(name)) {
-      throw Cr.NS_ERROR_NOT_AVAILABLE;
+      return "";
     }
     return this.getProperty(name);
   },
   getPropertyAsAUTF8String(name) {
     if (!this._properties.has(name)) {
       throw Cr.NS_ERROR_NOT_AVAILABLE;
     }
     return this.getProperty(name);
@@ -231,17 +231,32 @@ AddrBookCard.prototype = {
   },
   generatePhoneticName(lastNameFirst) {
     if (lastNameFirst) {
       return `${this.lastName}, ${this.firstName}`;
     }
     return `${this.firstName} ${this.lastName}`;
   },
   generateChatName() {
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
+    for (let name of [
+      "_GoogleTalk",
+      "_AimScreenName",
+      "_Yahoo",
+      "_Skype",
+      "_QQ",
+      "_MSN",
+      "_ICQ",
+      "_JabberId",
+      "_IRC",
+    ]) {
+      if (this._properties.has(name)) {
+        return this._properties.get(name);
+      }
+    }
+    return "";
   },
   copy(srcCard) {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
   equals(card) {
     return this.UID == card.UID;
   },
 };