Bug 1200549 - Only use requestBuddyInfo in tooltips for JS prpls. r=clokep, a=rkent
authoraleth <aleth@instantbird.org>
Wed, 23 Sep 2015 02:04:21 +0200
changeset 20791 21eeb3aa2f963dad9659d89059fb48353090c5e1
parent 20790 4829f1271bde671b89344e9b310082855d52392e
child 20792 64ba3a65e39991dad06e1a42a6ae84e03a8371c9
push id1539
push userkent@caspia.com
push dateWed, 07 Oct 2015 08:58:11 +0000
treeherdercomm-aurora@21eeb3aa2f96 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep, rkent
bugs1200549
Bug 1200549 - Only use requestBuddyInfo in tooltips for JS prpls. r=clokep, a=rkent
chat/content/imtooltip.xml
--- a/chat/content/imtooltip.xml
+++ b/chat/content/imtooltip.xml
@@ -188,16 +188,24 @@
        </body>
      </method>
 
      <method name="requestBuddyInfo">
        <parameter name="aAccount"/>
        <parameter name="aObservedName"/>
        <body>
        <![CDATA[
+         // Libpurple prpls don't necessarily return data in response to
+         // requestBuddyInfo that is suitable for displaying inside a
+         // tooltip (e.g. too many objects, or <img> and <a> tags),
+         // so we only use it for JS prpls.
+         // This is a terrible, terrible hack to work around the fact that
+         // ClassInfo.implementationLanguage has gone.
+         if (!aAccount.prplAccount.wrappedJSObject)
+           return;
          this.observedUserInfo = aObservedName;
          Services.obs.addObserver(this, "user-info-received", false);
          aAccount.requestBuddyInfo(aObservedName);
        ]]>
        </body>
      </method>
 
      <method name="updateTooltipFromBuddy">
@@ -218,25 +226,17 @@
          this.setAttribute("status", Status.toAttribute(statusType));
          this.setMessage(Status.toLabel(statusType, aBuddy.statusText));
 
          if (displayName != name)
            this.addRow(this.bundle.GetStringFromName("buddy.username"), name);
 
          this.addRow(this.bundle.GetStringFromName("buddy.account"), account.name);
 
-         // Technically there is no reason to restrict this. But there is
-         // currently no filtering mechanism in place to select which of the
-         // returned fields are to be added to the tooltip for the other
-         // protocols (libpurple in particular).
-         let forcePurple = Services.prefs.getCharPref("chat.prpls.forcePurple");
-         let protocolId = account.protocol.id;
-         if (protocolId == "prpl-irc" ||
-             (!forcePurple.includes("prpl-jabber") && protocolId == "prpl-jabber"))
-           this.requestBuddyInfo(account, aBuddy.normalizedName);
+         this.requestBuddyInfo(account, aBuddy.normalizedName);
 
          var tooltipInfo = aBuddy.getTooltipInfo();
          if (tooltipInfo)
            this.appendTooltipInfo(tooltipInfo);
          return true;
        ]]>
        </body>
      </method>