diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:44:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:44:51 +0000 |
commit | 9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/chat/protocols/odnoklassniki | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/chat/protocols/odnoklassniki')
-rw-r--r-- | comm/chat/protocols/odnoklassniki/components.conf | 15 | ||||
-rw-r--r-- | comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki-32.png | bin | 0 -> 2165 bytes | |||
-rw-r--r-- | comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki-48.png | bin | 0 -> 2649 bytes | |||
-rw-r--r-- | comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki.png | bin | 0 -> 753 bytes | |||
-rw-r--r-- | comm/chat/protocols/odnoklassniki/jar.mn | 9 | ||||
-rw-r--r-- | comm/chat/protocols/odnoklassniki/moz.build | 14 | ||||
-rw-r--r-- | comm/chat/protocols/odnoklassniki/odnoklassniki.sys.mjs | 83 |
7 files changed, 121 insertions, 0 deletions
diff --git a/comm/chat/protocols/odnoklassniki/components.conf b/comm/chat/protocols/odnoklassniki/components.conf new file mode 100644 index 0000000000..0889166787 --- /dev/null +++ b/comm/chat/protocols/odnoklassniki/components.conf @@ -0,0 +1,15 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# 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/. + +Classes = [ + { + 'cid': '{29b09a83-81c1-2032-11e2-6d9bc4f8e969}', + 'contract_ids': ['@mozilla.org/chat/odnoklassniki;1'], + 'esModule': 'resource:///modules/odnoklassniki.sys.mjs', + 'constructor': 'OdnoklassnikiProtocol', + 'categories': {'im-protocol-plugin': 'prpl-odnoklassniki'}, + }, +] diff --git a/comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki-32.png b/comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki-32.png Binary files differnew file mode 100644 index 0000000000..5057ef77bf --- /dev/null +++ b/comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki-32.png diff --git a/comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki-48.png b/comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki-48.png Binary files differnew file mode 100644 index 0000000000..63e2517ffd --- /dev/null +++ b/comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki-48.png diff --git a/comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki.png b/comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki.png Binary files differnew file mode 100644 index 0000000000..8904397333 --- /dev/null +++ b/comm/chat/protocols/odnoklassniki/icons/prpl-odnoklassniki.png diff --git a/comm/chat/protocols/odnoklassniki/jar.mn b/comm/chat/protocols/odnoklassniki/jar.mn new file mode 100644 index 0000000000..8667e00236 --- /dev/null +++ b/comm/chat/protocols/odnoklassniki/jar.mn @@ -0,0 +1,9 @@ +# 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/. + +chat.jar: +% skin prpl-odnoklassniki classic/1.0 %skin/classic/prpl/odnoklassniki/ + skin/classic/prpl/odnoklassniki/icon32.png (icons/prpl-odnoklassniki-32.png) + skin/classic/prpl/odnoklassniki/icon48.png (icons/prpl-odnoklassniki-48.png) + skin/classic/prpl/odnoklassniki/icon.png (icons/prpl-odnoklassniki.png) diff --git a/comm/chat/protocols/odnoklassniki/moz.build b/comm/chat/protocols/odnoklassniki/moz.build new file mode 100644 index 0000000000..a7e9104619 --- /dev/null +++ b/comm/chat/protocols/odnoklassniki/moz.build @@ -0,0 +1,14 @@ +# vim: set filetype=python: +# 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/. + +JAR_MANIFESTS += ["jar.mn"] + +XPCOM_MANIFESTS += [ + "components.conf", +] + +EXTRA_JS_MODULES += [ + "odnoklassniki.sys.mjs", +] diff --git a/comm/chat/protocols/odnoklassniki/odnoklassniki.sys.mjs b/comm/chat/protocols/odnoklassniki/odnoklassniki.sys.mjs new file mode 100644 index 0000000000..de8fe2f42e --- /dev/null +++ b/comm/chat/protocols/odnoklassniki/odnoklassniki.sys.mjs @@ -0,0 +1,83 @@ +/* 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 { GenericProtocolPrototype } from "resource:///modules/jsProtoHelper.sys.mjs"; + +const lazy = {}; + +XPCOMUtils.defineLazyGetter(lazy, "_", () => + l10nHelper("chrome://chat/locale/xmpp.properties") +); +ChromeUtils.defineESModuleGetters(lazy, { + XMPPAccountPrototype: "resource:///modules/xmpp-base.sys.mjs", + XMPPSession: "resource:///modules/xmpp-session.sys.mjs", +}); + +XPCOMUtils.defineLazyGetter(lazy, "OdnoklassnikiAccount", () => { + function OdnoklassnikiAccount(aProtoInstance, aImAccount) { + this._init(aProtoInstance, aImAccount); + } + OdnoklassnikiAccount.prototype = { + __proto__: lazy.XMPPAccountPrototype, + get canJoinChat() { + return false; + }, + connect() { + if (!this.name.includes("@")) { + // TODO: Do not use the default resource value if the user has not + // specified it and let the service generate it. + let jid = + this.name + + "@odnoklassniki.ru/" + + Services.strings + .createBundle("chrome://branding/locale/brand.properties") + .GetStringFromName("brandShortName"); + this._jid = this._parseJID(jid); + } else { + this._jid = this._parseJID(this.name); + if (this._jid.domain != "odnoklassniki.ru") { + // We can't use this.onError because this._connection doesn't exist. + this.reportDisconnecting( + Ci.prplIAccount.ERROR_INVALID_USERNAME, + lazy._("connection.error.invalidUsername") + ); + this.reportDisconnected(); + return; + } + } + + this._connection = new lazy.XMPPSession( + "xmpp.odnoklassniki.ru", + 5222, + "require_tls", + this._jid, + this.imAccount.password, + this + ); + }, + }; + return OdnoklassnikiAccount; +}); + +export function OdnoklassnikiProtocol() {} +OdnoklassnikiProtocol.prototype = { + __proto__: GenericProtocolPrototype, + get normalizedName() { + return "odnoklassniki"; + }, + get name() { + return lazy._("odnoklassniki.protocolName"); + }, + get iconBaseURI() { + return "chrome://prpl-odnoklassniki/skin/"; + }, + get usernameEmptyText() { + return lazy._("odnoklassniki.usernameHint"); + }, + getAccount(aImAccount) { + return new lazy.OdnoklassnikiAccount(this, aImAccount); + }, +}; |