summaryrefslogtreecommitdiffstats
path: root/comm/chat/protocols/xmpp/xmpp.sys.mjs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /comm/chat/protocols/xmpp/xmpp.sys.mjs
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.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/xmpp/xmpp.sys.mjs')
-rw-r--r--comm/chat/protocols/xmpp/xmpp.sys.mjs106
1 files changed, 106 insertions, 0 deletions
diff --git a/comm/chat/protocols/xmpp/xmpp.sys.mjs b/comm/chat/protocols/xmpp/xmpp.sys.mjs
new file mode 100644
index 0000000000..08fdcd5629
--- /dev/null
+++ b/comm/chat/protocols/xmpp/xmpp.sys.mjs
@@ -0,0 +1,106 @@
+/* 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",
+});
+
+XPCOMUtils.defineLazyGetter(lazy, "XMPPAccount", () => {
+ function XMPPAccount(aProtoInstance, aImAccount) {
+ this._init(aProtoInstance, aImAccount);
+ }
+ XMPPAccount.prototype = lazy.XMPPAccountPrototype;
+ return XMPPAccount;
+});
+
+export function XMPPProtocol() {
+ this.commands = ChromeUtils.importESModule(
+ "resource:///modules/xmpp-commands.sys.mjs"
+ ).commands;
+ this.registerCommands();
+}
+
+XMPPProtocol.prototype = {
+ __proto__: GenericProtocolPrototype,
+ get normalizedName() {
+ return "jabber";
+ },
+ get name() {
+ return "XMPP";
+ },
+ get iconBaseURI() {
+ return "chrome://prpl-jabber/skin/";
+ },
+ getAccount(aImAccount) {
+ return new lazy.XMPPAccount(this, aImAccount);
+ },
+
+ usernameSplits: [
+ {
+ get label() {
+ return lazy._("options.domain");
+ },
+ separator: "@",
+ defaultValue: "jabber.org",
+ },
+ ],
+
+ options: {
+ resource: {
+ get label() {
+ return lazy._("options.resource");
+ },
+ default: "",
+ },
+ priority: {
+ get label() {
+ return lazy._("options.priority");
+ },
+ default: 0,
+ },
+ connection_security: {
+ get label() {
+ return lazy._("options.connectionSecurity");
+ },
+ listValues: {
+ get require_tls() {
+ return lazy._("options.connectionSecurity.requireEncryption");
+ },
+ get opportunistic_tls() {
+ return lazy._("options.connectionSecurity.opportunisticTLS");
+ },
+ get allow_unencrypted_plain_auth() {
+ return lazy._("options.connectionSecurity.allowUnencryptedAuth");
+ },
+ // "old_ssl" and "none" are also supported, but not exposed in the UI.
+ // Any unknown value will fallback to the opportunistic_tls behavior.
+ },
+ default: "require_tls",
+ },
+ server: {
+ get label() {
+ return lazy._("options.connectServer");
+ },
+ default: "",
+ },
+ port: {
+ get label() {
+ return lazy._("options.connectPort");
+ },
+ default: 5222,
+ },
+ },
+ get chatHasTopic() {
+ return true;
+ },
+};