summaryrefslogtreecommitdiffstats
path: root/comm/chat/protocols/gtalk/gtalk.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'comm/chat/protocols/gtalk/gtalk.sys.mjs')
-rw-r--r--comm/chat/protocols/gtalk/gtalk.sys.mjs60
1 files changed, 60 insertions, 0 deletions
diff --git a/comm/chat/protocols/gtalk/gtalk.sys.mjs b/comm/chat/protocols/gtalk/gtalk.sys.mjs
new file mode 100644
index 0000000000..ca5b7c33a6
--- /dev/null
+++ b/comm/chat/protocols/gtalk/gtalk.sys.mjs
@@ -0,0 +1,60 @@
+/* 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/. */
+
+import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
+import { l10nHelper } from "resource:///modules/imXPCOMUtils.sys.mjs";
+import {
+ GenericAccountPrototype,
+ GenericProtocolPrototype,
+} from "resource:///modules/jsProtoHelper.sys.mjs";
+
+const lazy = {};
+
+XPCOMUtils.defineLazyGetter(lazy, "_", () =>
+ l10nHelper("chrome://chat/locale/xmpp.properties")
+);
+
+function GTalkAccount(aProtoInstance, aImAccount) {
+ this._init(aProtoInstance, aImAccount);
+}
+GTalkAccount.prototype = {
+ __proto__: GenericAccountPrototype,
+ connect() {
+ this.WARN(
+ "As Google deprecated its XMPP gateway, it is currently not " +
+ "possible to connect to Google Talk. See bug 1645217."
+ );
+ this.reportDisconnecting(
+ Ci.prplIAccount.ERROR_OTHER_ERROR,
+ lazy._("gtalk.disabled")
+ );
+ this.reportDisconnected();
+ },
+
+ // Nothing to do.
+ unInit() {},
+ remove() {},
+};
+
+export function GTalkProtocol() {}
+GTalkProtocol.prototype = {
+ __proto__: GenericProtocolPrototype,
+ get normalizedName() {
+ return "gtalk";
+ },
+ get name() {
+ return lazy._("gtalk.protocolName");
+ },
+ get iconBaseURI() {
+ return "chrome://prpl-gtalk/skin/";
+ },
+ getAccount(aImAccount) {
+ return new GTalkAccount(this, aImAccount);
+ },
+ // GTalk accounts which were configured with OAuth2 do not have a password set.
+ // Show the above error on connect instead of a "needs password" error.
+ get noPassword() {
+ return true;
+ },
+};