chat/protocols/facebook/facebook.jsm
author Khushil Mistry <khushil324@gmail.com>
Fri, 08 May 2020 15:42:48 +1200
changeset 39025 f25512b597325260e72b0f45e06d2f6ac9f6dc7b
parent 37697 8d558f7fb2cc3088b6c797354ae164c0012b4ce2
permissions -rw-r--r--
Bug 1635734 - Fix Chat broken in Thunderbird for macOS. r=clokep a=wsmwk

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var EXPORTED_SYMBOLS = ["FacebookProtocol"];

var { XPCOMUtils, l10nHelper } = ChromeUtils.import(
  "resource:///modules/imXPCOMUtils.jsm"
);
var { GenericAccountPrototype, GenericProtocolPrototype } = ChromeUtils.import(
  "resource:///modules/jsProtoHelper.jsm"
);

XPCOMUtils.defineLazyGetter(this, "_", () =>
  l10nHelper("chrome://chat/locale/facebook.properties")
);

function FacebookAccount(aProtoInstance, aImAccount) {
  this._init(aProtoInstance, aImAccount);
}
FacebookAccount.prototype = {
  __proto__: GenericAccountPrototype,

  connect() {
    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,
      _("facebook.disabled")
    );
    this.reportDisconnected();
  },

  // Nothing to do.
  unInit() {},
};

function FacebookProtocol() {}
FacebookProtocol.prototype = {
  __proto__: GenericProtocolPrototype,
  get normalizedName() {
    return "facebook";
  },
  get name() {
    return _("facebook.chat.name");
  },
  get iconBaseURI() {
    return "chrome://prpl-facebook/skin/";
  },
  getAccount(aImAccount) {
    return new FacebookAccount(this, aImAccount);
  },
};