Bug 1236133 - Disable facebook prpl. r=clokep a=aleth a=rkent
authoraleth <aleth@instantbird.org>
Fri, 29 Jan 2016 20:45:20 +0100
changeset 26705 2d0a5e8bd2ea02114da6b465d469020c1809a86f
parent 26704 0e6bd151c024421bdb3096592e79aa8b1a7ba77a
child 26706 cfd8eb244210d1d3e88c55ef34474ab87f0da449
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersclokep, aleth, rkent
bugs1236133
Bug 1236133 - Disable facebook prpl. r=clokep a=aleth a=rkent
chat/chat-prefs.js
chat/protocols/facebook/facebook.js
im/content/accountWizard.js
im/locales/en-US/chrome/instantbird/accountWizard.properties
--- a/chat/chat-prefs.js
+++ b/chat/chat-prefs.js
@@ -77,16 +77,18 @@ pref("messenger.status.userDisplayName",
 // Default message used when quitting IRC. This is overridable per account.
 pref("chat.irc.defaultQuitMessage", "");
 // If this is true, requestRooomInfo will return LIST results when it is
 // called automatically by the awesometab. Otherwise, requestRoomInfo will
 // only do so when explicitly requested by the user, e.g. via the /list command.
 pref("chat.irc.automaticList", true);
 // Disable Skype until it can be tested further.
 pref("chat.prpls.prpl-skype.disable", true);
+// Disable Facebook as the XMPP gateway no longer exists.
+pref("chat.prpls.prpl-facebook.disable", true);
 
 // loglevel is the minimum severity level that a libpurple message
 // must have to be reported in the Error Console.
 //
 // The possible values are:
 //   0  Show all libpurple messages (PURPLE_DEBUG_ALL)
 //   1  Very verbose (PURPLE_DEBUG_MISC)
 //   2  Verbose (PURPLE_DEBUG_INFO)
--- a/chat/protocols/facebook/facebook.js
+++ b/chat/protocols/facebook/facebook.js
@@ -7,45 +7,32 @@ var {interfaces: Ci, utils: Cu} = Compon
 Cu.import("resource:///modules/imXPCOMUtils.jsm");
 Cu.import("resource:///modules/jsProtoHelper.jsm");
 Cu.import("resource:///modules/xmpp.jsm");
 Cu.import("resource:///modules/xmpp-session.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "_", () =>
   l10nHelper("chrome://chat/locale/facebook.properties")
 );
+XPCOMUtils.defineLazyGetter(this, "_irc", () =>
+  l10nHelper("chrome://chat/locale/irc.properties")
+);
 
 function FacebookAccount(aProtoInstance, aImAccount) {
   this._init(aProtoInstance, aImAccount);
 }
 FacebookAccount.prototype = {
   __proto__: XMPPAccountPrototype,
   get canJoinChat() { return false; },
   connect: function() {
-    if (!this.name.includes("@")) {
-      let jid = this.name + "@chat.facebook.com/" + XMPPDefaultResource;
-      this._jid = this._parseJID(jid);
-    }
-    else {
-      this._jid = this._parseJID(this.name);
-      if (this._jid.domain != "chat.facebook.com") {
-        // We can't use this.onError because this._connection doesn't exist.
-        this.reportDisconnecting(Ci.prplIAccount.ERROR_INVALID_USERNAME,
-                                 _("connection.error.useUsernameNotEmailAddress"));
-        this.reportDisconnected();
-        return;
-      }
-    }
-
-    let server = "chat.facebook.com";
-    if (this.prefs.prefHasUserValue("server"))
-      server = this.getString("server");
-    this._connection = new XMPPSession(server, 5222, "require_tls",
-                                       this._jid, this.imAccount.password,
-                                       this);
+    this.WARN("As Facebook deprecated its XMPP gateway, it is currently not " +
+              "possible to connect to Facebook Chat. See bug 1141674.");
+    this.reportDisconnecting(Ci.prplIAccount.ERROR_OTHER_ERROR,
+                             _irc("error.unavailable", _("facebook.chat.name")));
+    this.reportDisconnected();
   }
 };
 
 function FacebookProtocol() {
 }
 FacebookProtocol.prototype = {
   __proto__: GenericProtocolPrototype,
   get normalizedName() { return "facebook"; },
--- a/im/content/accountWizard.js
+++ b/im/content/accountWizard.js
@@ -13,16 +13,23 @@ var accountWizard = {
     let bundle = document.getElementById("topProtocolsBundle");
     let topProtocols = bundle.getString("topProtocol.list").split(",");
 
     for (let topProto of topProtocols) {
       let proto = Services.core.getProtocolById(topProto);
       if (proto == null)
         continue;
 
+      // If the preference is set to disable this prpl, don't show it in the
+      // full list of protocols.
+      let pref = "chat.prpls." + topProto + ".disable";
+      if (Services.prefs.getPrefType(pref) == Services.prefs.PREF_BOOL &&
+          Services.prefs.getBoolPref(pref))
+        continue;
+
       let item = document.createElement("richlistitem");
       item.className = "top-protocol";
       topProtoList.insertBefore(item, document.getElementById("otherListItem"));
       let desc = bundle.getString("topProtocol." + proto.id + ".description");
       item.build(proto, desc);
     }
 
     if (topProtoList.itemCount < 2)
--- a/im/locales/en-US/chrome/instantbird/accountWizard.properties
+++ b/im/locales/en-US/chrome/instantbird/accountWizard.properties
@@ -3,18 +3,18 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # LOCALIZATION NOTE
 # The selected protocols below should be the most relevant
 # to the target language / location and comma delimited.
 # Exceeding 4 protocols may cause scrolling. A list of the
 # available protocols can be found at
 #     https://wiki.instantbird.org/Protocol_Identifiers
-topProtocol.list=prpl-gtalk,prpl-facebook,prpl-twitter,prpl-aim,prpl-yahoo
+topProtocol.list=prpl-gtalk,prpl-twitter,prpl-aim,prpl-yahoo,prpl-irc
 
 # LOCALIZATION NOTE
 # These are the descriptions of the top protocols specified above.
 # A description should be provided for each protocol ID listed above.
 topProtocol.prpl-gtalk.description=Talk to your Gmail contacts
-topProtocol.prpl-facebook.description=Communicate with Facebook friends
 topProtocol.prpl-twitter.description=Stay up to date with your Twitter timeline
 topProtocol.prpl-aim.description=Chat with your buddies on AOL Instant Messenger
 topProtocol.prpl-yahoo.description=Chat with friends using Yahoo! Messenger
+topProtocol.prpl-irc.description=Join IRC channels