Commit ce30b64b authored by JC Brand's avatar JC Brand Committed by GitHub

Merge branch 'master' into 1257_notifications-prefer-probably-over-maybe

parents daa1654d 6904f9a8
{
"parserOptions": {
"ecmaVersion": 2017
"ecmaVersion": 2017,
"sourceType": "module"
},
"env": {
"browser": true,
......
# Changelog
## 4.1.0 (Unreleased)
- Use [Lerna](https://lernajs.io/) to create the @converse/headless package
- Use ES2015 modules instead of UMD.
- #1257: Prefer 'probably' over 'maybe' when evaluating audio play support.
## 4.0.3 (2018-10-22)
......
......@@ -157,12 +157,16 @@ watchcss: dev
$(SASS) --watch -I $(BOURBON) -I $(BOOTSTRAP) sass:css
.PHONY: watchjs
watchjs: dev
watchjs: dev dist/converse-headless.js
./node_modules/.bin/npx webpack --mode=development --watch
.PHONY: watchjsheadless
watchjsheadless: dev
./node_modules/.bin/npx webpack --mode=development --watch --type=headless
.PHONY: watch
watch: dev
make -j 2 watchjs watchcss
make -j 3 watchcss watchjsheadless watchjs
.PHONY: logo
logo: logo/conversejs-transparent16.png \
......
This diff is collapsed.
......@@ -1555,10 +1555,9 @@
it("properly handles notification that a room has been destroyed",
mock.initConverseWithPromises(
null, ['rosterGroupsFetched'], {},
function (done, _converse) {
async function (done, _converse) {
test_utils.openChatRoomViaModal(_converse, 'problematic@muc.localhost', 'dummy')
.then(function () {
await test_utils.openChatRoomViaModal(_converse, 'problematic@muc.localhost', 'dummy')
const presence = $pres().attrs({
from:'problematic@muc.localhost',
id:'n13mt3l',
......@@ -1582,7 +1581,6 @@
expect(view.el.querySelector('.chatroom-body .moved-link').textContent.trim())
.toBe(`other-room@chat.jabberfr.org`);
done();
}).catch(_.partial(console.error, _));
}));
it("will use the user's reserved nickname, if it exists",
......
......@@ -15,27 +15,23 @@
null, ['rosterGroupsFetched', 'chatBoxesFetched'],
{ allow_bookmarks: false // Makes testing easier, otherwise we
// have to mock stanza traffic.
},
function (done, _converse) {
}, async function (done, _converse) {
test_utils.openControlBox();
const controlbox = _converse.chatboxviews.get('controlbox');
let list = controlbox.el.querySelector('div.rooms-list-container');
expect(_.includes(list.classList, 'hidden')).toBeTruthy();
let room_els;
test_utils.openChatRoom(_converse, 'room', 'conference.shakespeare.lit', 'JC')
.then(() => {
await test_utils.openChatRoom(_converse, 'room', 'conference.shakespeare.lit', 'JC');
expect(_.isUndefined(_converse.rooms_list_view)).toBeFalsy();
room_els = _converse.rooms_list_view.el.querySelectorAll(".open-room");
let room_els = _converse.rooms_list_view.el.querySelectorAll(".open-room");
expect(room_els.length).toBe(1);
expect(room_els[0].innerText).toBe('room@conference.shakespeare.lit');
return test_utils.openChatRoom(_converse, 'lounge', 'localhost', 'dummy');
}).then(() => {
await test_utils.openChatRoom(_converse, 'lounge', 'localhost', 'dummy');
room_els = _converse.rooms_list_view.el.querySelectorAll(".open-room");
expect(room_els.length).toBe(2);
var view = _converse.chatboxviews.get('room@conference.shakespeare.lit');
let view = _converse.chatboxviews.get('room@conference.shakespeare.lit');
view.close();
room_els = _converse.rooms_list_view.el.querySelectorAll(".open-room");
expect(room_els.length).toBe(1);
......@@ -51,7 +47,6 @@
list = controlbox.el.querySelector('div.rooms-list-container');
expect(_.includes(list.classList, 'hidden')).toBeTruthy();
done();
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
}
));
});
......
......@@ -7,15 +7,15 @@
// This plugin started as a fork of Lea Verou's Awesomplete
// https://leaverou.github.io/awesomplete/
(function (root, factory) {
define(["@converse/headless/converse-core"], factory);
}(this, function (converse) {
const { _, Backbone } = converse.env,
import converse from "@converse/headless/converse-core";
const { _, Backbone } = converse.env,
u = converse.env.utils;
converse.plugins.add("converse-autocomplete", {
converse.plugins.add("converse-autocomplete", {
initialize () {
const { _converse } = this;
......@@ -411,5 +411,4 @@
_converse.AutoComplete = AutoComplete;
}
});
}));
});
......@@ -9,28 +9,19 @@
/* This is a Converse.js plugin which add support for bookmarks specified
* in XEP-0048.
*/
(function (root, factory) {
define(["@converse/headless/converse-core",
"@converse/headless/converse-muc",
"templates/chatroom_bookmark_form.html",
"templates/chatroom_bookmark_toggle.html",
"templates/bookmark.html",
"templates/bookmarks_list.html"
],
factory);
}(this, function (
converse,
muc,
tpl_chatroom_bookmark_form,
tpl_chatroom_bookmark_toggle,
tpl_bookmark,
tpl_bookmarks_list
) {
const { Backbone, Promise, Strophe, $iq, b64_sha1, sizzle, _ } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-bookmarks', {
import converse from "@converse/headless/converse-core";
import muc from "@converse/headless/converse-muc";
import tpl_bookmark from "templates/bookmark.html";
import tpl_bookmarks_list from "templates/bookmarks_list.html"
import tpl_chatroom_bookmark_form from "templates/chatroom_bookmark_form.html";
import tpl_chatroom_bookmark_toggle from "templates/chatroom_bookmark_toggle.html";
const { Backbone, Promise, Strophe, $iq, b64_sha1, sizzle, _ } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-bookmarks', {
/* Plugin dependencies are other plugins which might be
* overridden or relied upon, and therefore need to be loaded before
......@@ -42,7 +33,7 @@
*
* NB: These plugins need to have already been loaded via require.js.
*/
dependencies: ["converse-chatboxes", "@converse/headless/converse-muc", "converse-muc-views"],
dependencies: ["converse-chatboxes", "converse-muc", "converse-muc-views"],
overrides: {
// Overrides mentioned here will be picked up by converse.js's
......@@ -583,5 +574,4 @@
});
}
});
}));
});
......@@ -4,19 +4,18 @@
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define(["@converse/headless/converse-core"], factory);
}(this, function (converse) {
const { Strophe, $build, _, b64_sha1 } = converse.env;
import converse from "@converse/headless/converse-core";
Strophe.addNamespace('CAPS', "http://jabber.org/protocol/caps");
const { Strophe, $build, _, b64_sha1 } = converse.env;
function propertySort (array, property) {
Strophe.addNamespace('CAPS', "http://jabber.org/protocol/caps");
function propertySort (array, property) {
return array.sort((a, b) => { return a[property] > b[property] ? -1 : 1 });
}
}
function generateVerificationString (_converse) {
function generateVerificationString (_converse) {
const identities = _converse.api.disco.own.identities.get(),
features = _converse.api.disco.own.features.get();
......@@ -34,18 +33,18 @@
features.sort();
S = _.reduce(features, (result, feature) => `${result}${feature}<`, S);
return b64_sha1(S);
}
}
function createCapsNode (_converse) {
function createCapsNode (_converse) {
return $build("c", {
'xmlns': Strophe.NS.CAPS,
'hash': "sha-1",
'node': "https://conversejs.org",
'ver': generateVerificationString(_converse)
}).nodeTree;
}
}
converse.plugins.add('converse-caps', {
converse.plugins.add('converse-caps', {
overrides: {
// Overrides mentioned here will be picked up by converse.js's
......@@ -59,5 +58,4 @@
}
}
}
});
}));
});
......@@ -4,20 +4,15 @@
// Copyright (c) 2012-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define([
"@converse/headless/converse-core",
"templates/chatboxes.html",
"@converse/headless/converse-chatboxes",
"backbone.nativeview",
"backbone.overview"
], factory);
}(this, function (converse, tpl_chatboxes) {
"use strict";
import "@converse/headless/converse-chatboxes";
import "backbone.nativeview";
import "backbone.overview";
import converse from "@converse/headless/converse-core";
import tpl_chatboxes from "templates/chatboxes.html";
const { Backbone, _ } = converse.env;
const { Backbone, _ } = converse.env;
const AvatarMixin = {
const AvatarMixin = {
renderAvatar (el) {
el = el || this.el;
......@@ -47,10 +42,10 @@
img.src = img_src;
});
},
};
};
converse.plugins.add('converse-chatboxviews', {
converse.plugins.add('converse-chatboxviews', {
dependencies: ["converse-chatboxes"],
......@@ -174,6 +169,4 @@
_converse.api.listen.on('clearSession', () => _converse.chatboxviews.closeAllChatBoxes());
/************************ END Event Handlers ************************/
}
});
return converse;
}));
});
// Converse.js
// http://conversejs.org
//
// Copyright (c) 2012-2018, the Converse.js developers
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define([
"utils/emoji",
"@converse/headless/converse-core",
"bootstrap",
"twemoji",
"xss",
"templates/chatbox.html",
"templates/chatbox_head.html",
"templates/chatbox_message_form.html",
"templates/emojis.html",
"templates/error_message.html",
"templates/help_message.html",
"templates/info.html",
"templates/new_day.html",
"templates/user_details_modal.html",
"templates/toolbar_fileupload.html",
"templates/spinner.html",
"templates/spoiler_button.html",
"templates/status_message.html",
"templates/toolbar.html",
"converse-modal",
"converse-chatboxviews",
"converse-message-view"
], factory);
}(this, function (
u,
converse,
bootstrap,
twemoji,
xss,
tpl_chatbox,
tpl_chatbox_head,
tpl_chatbox_message_form,
tpl_emojis,
tpl_error_message,
tpl_help_message,
tpl_info,
tpl_new_day,
tpl_user_details_modal,
tpl_toolbar_fileupload,
tpl_spinner,
tpl_spoiler_button,
tpl_status_message,
tpl_toolbar
) {
"use strict";
const { $msg, Backbone, Promise, Strophe, _, b64_sha1, f, sizzle, moment } = converse.env;
converse.plugins.add('converse-chatview', {
import "converse-chatboxviews";
import "converse-message-view";
import "converse-modal";
import * as twemoji from "twemoji";
import bootstrap from "bootstrap";
import converse from "@converse/headless/converse-core";
import tpl_chatbox from "templates/chatbox.html";
import tpl_chatbox_head from "templates/chatbox_head.html";
import tpl_chatbox_message_form from "templates/chatbox_message_form.html";
import tpl_emojis from "templates/emojis.html";
import tpl_error_message from "templates/error_message.html";
import tpl_help_message from "templates/help_message.html";
import tpl_info from "templates/info.html";
import tpl_new_day from "templates/new_day.html";
import tpl_spinner from "templates/spinner.html";
import tpl_spoiler_button from "templates/spoiler_button.html";
import tpl_status_message from "templates/status_message.html";
import tpl_toolbar from "templates/toolbar.html";
import tpl_toolbar_fileupload from "templates/toolbar_fileupload.html";
import tpl_user_details_modal from "templates/user_details_modal.html";
import u from "utils/emoji";
import xss from "xss";
const { $msg, Backbone, Promise, Strophe, _, b64_sha1, f, sizzle, moment } = converse.env;
converse.plugins.add('converse-chatview', {
/* Plugin dependencies are other plugins which might be
* overridden or relied upon, and therefore need to be loaded before
* this plugin.
......@@ -1340,7 +1317,4 @@
});
/************************ END API ************************/
}
});
return converse;
}));
});
......@@ -6,36 +6,23 @@
//
/*global define */
(function (root, factory) {
define(["@converse/headless/converse-core",
"bootstrap",
"formdata-polyfill",
"@converse/headless/lodash.fp",
"templates/converse_brand_heading.html",
"templates/controlbox.html",
"templates/controlbox_toggle.html",
"templates/login_panel.html",
"converse-chatview",
"converse-rosterview",
"converse-profile"
], factory);
}(this, function (
converse,
bootstrap,
_FormData,
fp,
tpl_brand_heading,
tpl_controlbox,
tpl_controlbox_toggle,
tpl_login_panel
) {
"use strict";
const CHATBOX_TYPE = 'chatbox';
const { Strophe, Backbone, Promise, _, moment } = converse.env;
const u = converse.env.utils;
const CONNECTION_STATUS_CSS_CLASS = {
import "converse-chatview";
import "converse-profile";
import "converse-rosterview";
import _FormData from "formdata-polyfill";
import bootstrap from "bootstrap";
import converse from "@converse/headless/converse-core";
import fp from "@converse/headless/lodash.fp";
import tpl_brand_heading from "templates/converse_brand_heading.html";
import tpl_controlbox from "templates/controlbox.html";
import tpl_controlbox_toggle from "templates/controlbox_toggle.html";
import tpl_login_panel from "templates/login_panel.html";
const CHATBOX_TYPE = 'chatbox';
const { Strophe, Backbone, Promise, _, moment } = converse.env;
const u = converse.env.utils;
const CONNECTION_STATUS_CSS_CLASS = {
'Error': 'error',
'Connecting': 'info',
'Connection failure': 'error',
......@@ -47,9 +34,9 @@
'Attached': 'info',
'Redirect': 'info',
'Reconnecting': 'warn'
};
};
const PRETTY_CONNECTION_STATUS = {
const PRETTY_CONNECTION_STATUS = {
0: 'Error',
1: 'Connecting',
2: 'Connection failure',
......@@ -61,9 +48,9 @@
8: 'Attached',
9: 'Redirect',
10: 'Reconnecting'
};
};
const REPORTABLE_STATUSES = [
const REPORTABLE_STATUSES = [
0, // ERROR'
1, // CONNECTING
2, // CONNFAIL
......@@ -71,9 +58,9 @@
4, // AUTHFAIL
7, // DISCONNECTING
10 // RECONNECTING
];
];
converse.plugins.add('converse-controlbox', {
converse.plugins.add('converse-controlbox', {
/* Plugin dependencies are other plugins which might be
* overridden or relied upon, and therefore need to be loaded before
* this plugin.
......@@ -624,5 +611,4 @@
_converse.on('disconnected', () => disconnect().renderLoginPanel());
_converse.on('will-reconnect', disconnect);
}
});
}));
});
......@@ -6,17 +6,14 @@
//
/*global define, window, document */
(function (root, factory) {
define(["@converse/headless/converse-core",
"templates/dragresize.html",
"converse-chatview",
"converse-controlbox"
], factory);
}(this, function (converse, tpl_dragresize) {
"use strict";
const { _ } = converse.env;
function renderDragResizeHandles (_converse, view) {
import "converse-chatview";
import "converse-controlbox";
import converse from "@converse/headless/converse-core";
import tpl_dragresize from "templates/dragresize.html";
const { _ } = converse.env;
function renderDragResizeHandles (_converse, view) {
const flyout = view.el.querySelector('.box-flyout');
const div = document.createElement('div');
div.innerHTML = tpl_dragresize();
......@@ -24,10 +21,10 @@
div,
flyout.firstChild
);
}
}
converse.plugins.add('converse-dragresize', {
converse.plugins.add('converse-dragresize', {
/* Plugin dependencies are other plugins which might be
* overridden or relied upon, and therefore need to be loaded before
* this plugin.
......@@ -367,5 +364,5 @@
return value;
};
}
});
}));
});
// Converse.js
// http://conversejs.org
//
// Copyright (c) 2012-2018, the Converse.js developers
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define(["@converse/headless/converse-core", "@converse/headless/converse-muc"], factory);
}(this, function (converse) {
"use strict";
const { Backbone, _ } = converse.env;
import "@converse/headless/converse-muc";
import converse from "@converse/headless/converse-core";
converse.plugins.add('converse-embedded', {
const { Backbone, _ } = converse.env;
converse.plugins.add('converse-embedded', {
enabled (_converse) {
return _converse.view_mode === 'embedded';
......@@ -36,5 +35,4 @@
"since only one chat room can be open at any time.");
}
}
});
}));
});
......@@ -4,21 +4,17 @@
// Copyright (c) JC Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define */
(function (root, factory) {
define(["@converse/headless/converse-core",
"templates/inverse_brand_heading.html",
"converse-chatview",
"converse-controlbox",
"@converse/headless/converse-muc",
"converse-singleton"
], factory);
}(this, function (converse, tpl_brand_heading) {
"use strict";
const { Strophe, _ } = converse.env;
converse.plugins.add('converse-fullscreen', {
import "@converse/headless/converse-muc";
import "converse-chatview";
import "converse-controlbox";
import "converse-singleton";
import converse from "@converse/headless/converse-core";
import tpl_brand_heading from "templates/inverse_brand_heading.html";
const { Strophe, _ } = converse.env;
converse.plugins.add('converse-fullscreen', {
enabled (_converse) {
return _.includes(['fullscreen', 'embedded'], _converse.view_mode);
......@@ -56,5 +52,4 @@
sticky_controlbox: true
});
}
});
}));
});
......@@ -3,20 +3,15 @@
//
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define */
(function (root, factory) {
define([
"@converse/headless/converse-core",
"templates/chatbox.html",
"converse-chatview",
], factory);
}(this, function (converse, tpl_chatbox) {
"use strict";
const { _, utils } = converse.env;
converse.plugins.add('converse-headline', {
import "converse-chatview";
import converse from "@converse/headless/converse-core";
import tpl_chatbox from "templates/chatbox.html";
const { _, utils } = converse.env;
converse.plugins.add('converse-headline', {
/* Plugin dependencies are other plugins which might be
* overridden or relied upon, and therefore need to be loaded before
* this plugin.
......@@ -152,5 +147,4 @@
});
});
}
});
}));
});
......@@ -4,36 +4,21 @@
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define([
"./utils/html",
"utils/emoji",
"@converse/headless/converse-core",
"xss",
"filesize",
"templates/csn.html",
"templates/file_progress.html",
"templates/info.html",
"templates/message.html",
"templates/message_versions_modal.html",
], factory);
}(this, function (
html,
u,
converse,
xss,
filesize,
tpl_csn,
tpl_file_progress,
tpl_info,
tpl_message,
tpl_message_versions_modal
) {
"use strict";
const { Backbone, _, moment } = converse.env;
import converse from "@converse/headless/converse-core";
import filesize from "filesize";
import html from "./utils/html";
import tpl_csn from "templates/csn.html";
import tpl_file_progress from "templates/file_progress.html";
import tpl_info from "templates/info.html";
import tpl_message from "templates/message.html";
import tpl_message_versions_modal from "templates/message_versions_modal.html";
import u from "utils/emoji";
import xss from "xss";
const { Backbone, _, moment } = converse.env;
converse.plugins.add('converse-message-view', {
converse.plugins.add('converse-message-view', {
initialize () {
/* The initialize function gets called as soon as the plugin is
......@@ -271,6 +256,4 @@
}
});
}
});
return converse;
}));
});
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
//
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Copyright (c) 2013-2018, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define, window, document */
(function (root, factory) {
define(["@converse/headless/converse-core",
"templates/chatbox_minimize.html",
"templates/toggle_chats.html",
"templates/trimmed_chat.html",
"templates/chats_panel.html",
"converse-chatview"
], factory);
}(this, function (
converse,
tpl_chatbox_minimize,
tpl_toggle_chats,
tpl_trimmed_chat,
tpl_chats_panel
) {
"use strict";
const { _ , Backbone, Promise, Strophe, b64_sha1, moment } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-minimize', {
import "converse-chatview";
import converse from "@converse/headless/converse-core";
import tpl_chatbox_minimize from "templates/chatbox_minimize.html";
import tpl_chats_panel from "templates/chats_panel.html";
import tpl_toggle_chats from "templates/toggle_chats.html";
import tpl_trimmed_chat from "templates/trimmed_chat.html";
const { _ , Backbone, Promise, Strophe, b64_sha1, moment } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-minimize', {
/* Optional dependencies are other plugins which might be
* overridden or relied upon, and therefore need to be loaded before
* this plugin. They are called "optional" because they might not be
......@@ -39,7 +28,7 @@
*
* NB: These plugins need to have already been loaded via require.js.
*/
dependencies: ["converse-chatview", "converse-controlbox", "@converse/headless/converse-muc", "converse-muc-views", "converse-headline"],
dependencies: ["converse-chatview", "converse-controlbox", "converse-muc", "converse-muc-views", "converse-headline"],
enabled (_converse) {
return _converse.view_mode == 'overlayed';
......@@ -548,5 +537,4 @@
}
});
}
});
}));
});
// Converse.js
// http://conversejs.org
//
// Copyright (c) 2018, the Converse.js developers
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
define([
"@converse/headless/converse-core",
"templates/alert_modal.html",
"bootstrap",
"backbone.vdomview"
], factory);
}
}(this, function (converse, tpl_alert_modal, bootstrap) {
"use strict";
import "backbone.vdomview";
import bootstrap from "bootstrap";
import converse from "@converse/headless/converse-core";
import tpl_alert_modal from "templates/alert_modal.html";
const { Strophe, Backbone, _ } = converse.env;
const { Strophe, Backbone, _ } = converse.env;
converse.plugins.add('converse-modal', {
converse.plugins.add('converse-modal', {
initialize () {
const { _converse } = this;
......@@ -113,5 +107,5 @@
}
});
}
});
}));
});
......@@ -4,70 +4,39 @@
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define([
"@converse/headless/converse-core",
"formdata-polyfill",
"utils/muc",
"xss",
"templates/add_chatroom_modal.html",
"templates/chatarea.html",
"templates/chatroom.html",
"templates/chatroom_details_modal.html",
"templates/chatroom_destroyed.html",
"templates/chatroom_disconnect.html",
"templates/chatroom_features.html",
"templates/chatroom_form.html",
"templates/chatroom_head.html",
"templates/chatroom_invite.html",
"templates/chatroom_nickname_form.html",
"templates/chatroom_password_form.html",
"templates/chatroom_sidebar.html",
"templates/info.html",
"templates/list_chatrooms_modal.html",
"templates/occupant.html",
"templates/room_description.html",
"templates/room_item.html",
"templates/room_panel.html",
"templates/rooms_results.html",
"templates/spinner.html",
"awesomplete",
"converse-modal"
], factory);
}(this, function (
converse,
_FormData,
muc_utils,
xss,
tpl_add_chatroom_modal,
tpl_chatarea,
tpl_chatroom,
tpl_chatroom_details_modal,
tpl_chatroom_destroyed,
tpl_chatroom_disconnect,
tpl_chatroom_features,
tpl_chatroom_form,
tpl_chatroom_head,
tpl_chatroom_invite,
tpl_chatroom_nickname_form,
tpl_chatroom_password_form,
tpl_chatroom_sidebar,
tpl_info,
tpl_list_chatrooms_modal,
tpl_occupant,
tpl_room_description,
tpl_room_item,
tpl_room_panel,
tpl_rooms_results,
tpl_spinner,
Awesomplete
) {
"use strict";
const { Backbone, Promise, Strophe, b64_sha1, moment, f, sizzle, _, $build, $iq, $msg, $pres } = converse.env;
const u = converse.env.utils;
const ROOM_FEATURES_MAP = {
import "converse-modal";
import Awesomplete from "awesomplete";
import _FormData from "formdata-polyfill";
import converse from "@converse/headless/converse-core";
import muc_utils from "utils/muc";
import tpl_add_chatroom_modal from "templates/add_chatroom_modal.html";
import tpl_chatarea from "templates/chatarea.html";
import tpl_chatroom from "templates/chatroom.html";
import tpl_chatroom_destroyed from "templates/chatroom_destroyed.html";
import tpl_chatroom_details_modal from "templates/chatroom_details_modal.html";
import tpl_chatroom_disconnect from "templates/chatroom_disconnect.html";
import tpl_chatroom_features from "templates/chatroom_features.html";
import tpl_chatroom_form from "templates/chatroom_form.html";
import tpl_chatroom_head from "templates/chatroom_head.html";
import tpl_chatroom_invite from "templates/chatroom_invite.html";
import tpl_chatroom_nickname_form from "templates/chatroom_nickname_form.html";
import tpl_chatroom_password_form from "templates/chatroom_password_form.html";
import tpl_chatroom_sidebar from "templates/chatroom_sidebar.html";
import tpl_info from "templates/info.html";
import tpl_list_chatrooms_modal from "templates/list_chatrooms_modal.html";
import tpl_occupant from "templates/occupant.html";
import tpl_room_description from "templates/room_description.html";
import tpl_room_item from "templates/room_item.html";
import tpl_room_panel from "templates/room_panel.html";
import tpl_rooms_results from "templates/rooms_results.html";
import tpl_spinner from "templates/spinner.html";
import xss from "xss";
const { Backbone, Promise, Strophe, b64_sha1, moment, f, sizzle, _, $build, $iq, $msg, $pres } = converse.env;
const u = converse.env.utils;
const ROOM_FEATURES_MAP = {
'passwordprotected': 'unsecured',
'unsecured': 'passwordprotected',
'hidden': 'publicroom',
......@@ -80,9 +49,9 @@
'semianonymous': 'nonanonymous',
'moderated': 'unmoderated',
'unmoderated': 'moderated'
};
};
converse.plugins.add('converse-muc-views', {
converse.plugins.add('converse-muc-views', {
/* Dependencies are other plugins which might be
* overridden or relied upon, and therefore need to be loaded before
* this plugin. They are "optional" because they might not be
......@@ -2145,5 +2114,5 @@
}
});
}
});
}));
});
......@@ -6,14 +6,13 @@
//
/*global define */
(function (root, factory) {
define(["@converse/headless/converse-core"], factory);
}(this, function (converse) {
"use strict";
const { Strophe, _, sizzle } = converse.env,
import converse from "@converse/headless/converse-core";
const { Strophe, _, sizzle } = converse.env,
u = converse.env.utils;
converse.plugins.add('converse-notification', {
converse.plugins.add('converse-notification', {
dependencies: ["converse-chatboxes"],
......@@ -103,27 +102,26 @@
_converse.isMessageToHiddenChat(message);
};
_converse.playSoundNotification = function () {
/* Plays a sound to notify that a new message was recieved.
*/
// XXX Eventually this can be refactored to use Notification's sound
// feature, but no browser currently supports it.
// https://developer.mozilla.org/en-US/docs/Web/API/notification/sound
let audioOgg, audioMp3, canPlayOgg, canPlayMp3;
if (_converse.play_sounds && !_.isUndefined(window.Audio)) {
audioOgg = new Audio(_converse.sounds_path+"msg_received.ogg");
canPlayOgg = audioOgg.canPlayType('audio/ogg');
audioMp3 = new Audio(_converse.sounds_path+"msg_received.mp3");
canPlayMp3 = audioMp3.canPlayType('audio/mp3');
// Prefer 'probably' over 'maybe'.
if ( canPlayOgg === 'probably') {
audioOgg.play();
} else if ( canPlayMp3 === 'probably' ) {
const audioOgg = new Audio(_converse.sounds_path+"msg_received.ogg");
const canPlayOgg = audioOgg.canPlayType('audio/ogg');
if (canPlayOgg === 'probably') {
return audioOgg.play();
}
const audioMp3 = new Audio(_converse.sounds_path+"msg_received.mp3");
const canPlayMp3 = audioMp3.canPlayType('audio/mp3');
if (canPlayMp3 === 'probably') {
audioMp3.play();
} else if ( canPlayOgg === 'maybe' ) {
} else if (canPlayOgg === 'maybe') {
audioOgg.play();
} else if ( canPlayMp3 === 'maybe' ) {
} else if (canPlayMp3 === 'maybe') {
audioMp3.play();
}
}
......@@ -293,5 +291,5 @@
_converse.on('connected', _converse.requestPermission);
});
}
});
}));
});
......@@ -4,24 +4,17 @@
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as a module called "myplugin"
define(["@converse/headless/converse-core", "templates/oauth_providers.html", "hellojs"], factory);
} else {
// Browser globals. If you're not using a module loader such as require.js,
// then this line below executes. Make sure that your plugin's <script> tag
// appears after the one from converse.js.
factory(converse);
}
}(this, function (converse, tpl_oauth_providers, hello) {
'use strict';
const _ = converse.env._,
import converse from "@converse/headless/converse-core";
import hello from "hellojs";
import tpl_oauth_providers from "templates/oauth_providers.html";
const _ = converse.env._,
Backbone = converse.env.Backbone,
Strophe = converse.env.Strophe;
// The following line registers your plugin.
converse.plugins.add("converse-oauth", {
// The following line registers your plugin.
converse.plugins.add("converse-oauth", {
/* Optional dependencies are other plugins which might be
* overridden or relied upon, and therefore need to be loaded before
......@@ -142,5 +135,5 @@
}
});
}
});
}));
});
......@@ -6,32 +6,28 @@
/* global libsignal, ArrayBuffer, parseInt, crypto */
(function (root, factory) {
define([
"@converse/headless/converse-core",
"templates/toolbar_omemo.html"
], factory);
}(this, function (converse, tpl_toolbar_omemo) {
const { Backbone, Promise, Strophe, moment, sizzle, $iq, $msg, _, f, b64_sha1 } = converse.env;
const u = converse.env.utils;
Strophe.addNamespace('OMEMO_DEVICELIST', Strophe.NS.OMEMO+".devicelist");
Strophe.addNamespace('OMEMO_VERIFICATION', Strophe.NS.OMEMO+".verification");
Strophe.addNamespace('OMEMO_WHITELISTED', Strophe.NS.OMEMO+".whitelisted");
Strophe.addNamespace('OMEMO_BUNDLES', Strophe.NS.OMEMO+".bundles");
const UNDECIDED = 0;
const TRUSTED = 1;
const UNTRUSTED = -1;
const TAG_LENGTH = 128;
const KEY_ALGO = {
import converse from "@converse/headless/converse-core";
import tpl_toolbar_omemo from "templates/toolbar_omemo.html";
const { Backbone, Promise, Strophe, moment, sizzle, $iq, $msg, _, f, b64_sha1 } = converse.env;
const u = converse.env.utils;
Strophe.addNamespace('OMEMO_DEVICELIST', Strophe.NS.OMEMO+".devicelist");
Strophe.addNamespace('OMEMO_VERIFICATION', Strophe.NS.OMEMO+".verification");
Strophe.addNamespace('OMEMO_WHITELISTED', Strophe.NS.OMEMO+".whitelisted");
Strophe.addNamespace('OMEMO_BUNDLES', Strophe.NS.OMEMO+".bundles");
const UNDECIDED = 0;
const TRUSTED = 1;
const UNTRUSTED = -1;
const TAG_LENGTH = 128;
const KEY_ALGO = {
'name': "AES-GCM",
'length': 128
};
};
function parseBundle (bundle_el) {
function parseBundle (bundle_el) {
/* Given an XML element representing a user's OMEMO bundle, parse it
* and return a map.
*/
......@@ -56,10 +52,10 @@
},
'prekeys': prekeys
}
}
}
converse.plugins.add('converse-omemo', {
converse.plugins.add('converse-omemo', {
enabled (_converse) {
return !_.isNil(window.libsignal) && !f.includes('converse-omemo', _converse.blacklisted_plugins);
......@@ -1049,5 +1045,5 @@
_converse.generateFingerprints(_converse.bare_jid).catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR));
});
}
});
}));
});
......@@ -6,35 +6,23 @@
//
/*global define */
(function (root, factory) {
define(["@converse/headless/converse-core",
"bootstrap",
"formdata-polyfill",
"templates/alert.html",
"templates/chat_status_modal.html",
"templates/profile_modal.html",
"templates/profile_view.html",
"templates/status_option.html",
"@converse/headless/converse-vcard",
"converse-modal"
], factory);
}(this, function (
converse,
bootstrap,
_FormData,
tpl_alert,
tpl_chat_status_modal,
tpl_profile_modal,
tpl_profile_view,
tpl_status_option
) {
"use strict";
const { Strophe, Backbone, Promise, utils, _, moment } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-profile', {
import "@converse/headless/converse-vcard";
import "converse-modal";
import _FormData from "formdata-polyfill";
import bootstrap from "bootstrap";
import converse from "@converse/headless/converse-core";
import tpl_alert from "templates/alert.html";
import tpl_chat_status_modal from "templates/chat_status_modal.html";
import tpl_profile_modal from "templates/profile_modal.html";
import tpl_profile_view from "templates/profile_view.html";
import tpl_status_option from "templates/status_option.html";
const { Strophe, Backbone, Promise, utils, _, moment } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-profile', {
dependencies: ["converse-modal", "converse-vcard", "converse-chatboxviews"],
......@@ -272,5 +260,5 @@
}
});
}
});
}));
});
......@@ -7,17 +7,16 @@
/* This is a Converse.js plugin which add support for registering
* an "App Server" as defined in XEP-0357
*/
(function (root, factory) {
define(["@converse/headless/converse-core"], factory);
}(this, function (converse) {
"use strict";
const { Strophe, $iq, _ } = converse.env;
Strophe.addNamespace('PUSH', 'urn:xmpp:push:0');
import converse from "@converse/headless/converse-core";
const { Strophe, $iq, _ } = converse.env;
converse.plugins.add('converse-push', {
Strophe.addNamespace('PUSH', 'urn:xmpp:push:0');
converse.plugins.add('converse-push', {
initialize () {
/* The initialize function gets called as soon as the plugin is
......@@ -131,5 +130,5 @@
_converse.api.listen.on('chatBoxesInitialized', () => _converse.chatboxes.on('add', onChatBoxAdded));
}
}
});
}));
});
......@@ -9,49 +9,36 @@
/* This is a Converse.js plugin which add support for in-band registration
* as specified in XEP-0077.
*/
(function (root, factory) {
define(["utils/form",
"@converse/headless/converse-core",
"templates/form_username.html",
"templates/register_link.html",
"templates/register_panel.html",
"templates/registration_form.html",
"templates/registration_request.html",
"templates/form_input.html",
"templates/spinner.html",
"converse-controlbox"
], factory);
}(this, function (
utils,
converse,
tpl_form_username,
tpl_register_link,
tpl_register_panel,
tpl_registration_form,
tpl_registration_request,
tpl_form_input,
tpl_spinner
) {
"use strict";
// Strophe methods for building stanzas
const { Strophe, Backbone, sizzle, $iq, _ } = converse.env;
// Add Strophe Namespaces
Strophe.addNamespace('REGISTER', 'jabber:iq:register');
// Add Strophe Statuses
let i = 0;
_.each(_.keys(Strophe.Status), function (key) {
import "converse-controlbox";
import converse from "@converse/headless/converse-core";
import tpl_form_input from "templates/form_input.html";
import tpl_form_username from "templates/form_username.html";
import tpl_register_link from "templates/register_link.html";
import tpl_register_panel from "templates/register_panel.html";
import tpl_registration_form from "templates/registration_form.html";
import tpl_registration_request from "templates/registration_request.html";
import tpl_spinner from "templates/spinner.html";
import utils from "utils/form";
// Strophe methods for building stanzas
const { Strophe, Backbone, sizzle, $iq, _ } = converse.env;
// Add Strophe Namespaces
Strophe.addNamespace('REGISTER', 'jabber:iq:register');
// Add Strophe Statuses
let i = 0;
_.each(_.keys(Strophe.Status), function (key) {
i = Math.max(i, Strophe.Status[key]);
});
Strophe.Status.REGIFAIL = i + 1;
Strophe.Status.REGISTERED = i + 2;
Strophe.Status.CONFLICT = i + 3;
Strophe.Status.NOTACCEPTABLE = i + 5;
});
Strophe.Status.REGIFAIL = i + 1;
Strophe.Status.REGISTERED = i + 2;
Strophe.Status.CONFLICT = i + 3;
Strophe.Status.NOTACCEPTABLE = i + 5;
converse.plugins.add('converse-register', {
converse.plugins.add('converse-register', {
'overrides': {
// Overrides mentioned here will be picked up by converse.js's
......@@ -698,5 +685,5 @@
}
});
}
});
}));
});
// Converse.js (A browser based XMPP chat client)
// http://conversejs.org
//
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Copyright (c) 2013-2018, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define */
/* This is a non-core Converse.js plugin which shows a list of currently open
* rooms in the "Rooms Panel" of the ControlBox.
*/
(function (root, factory) {
define(["@converse/headless/converse-core",
"@converse/headless/converse-muc",
"templates/rooms_list.html",
"templates/rooms_list_item.html"
], factory);
}(this, function (converse, muc, tpl_rooms_list, tpl_rooms_list_item) {
const { Backbone, Promise, Strophe, b64_sha1, sizzle, _ } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-roomslist', {
import converse from "@converse/headless/converse-core";
import muc from "@converse/headless/converse-muc";
import tpl_rooms_list from "templates/rooms_list.html";
import tpl_rooms_list_item from "templates/rooms_list_item.html"
const { Backbone, Promise, Strophe, b64_sha1, sizzle, _ } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-roomslist', {
/* Optional dependencies are other plugins which might be
* overridden or relied upon, and therefore need to be loaded before
......@@ -33,7 +31,7 @@
*
* NB: These plugins need to have already been loaded via require.js.
*/
dependencies: ["converse-singleton", "converse-controlbox", "@converse/headless/converse-muc", "converse-bookmarks"],
dependencies: ["converse-singleton", "converse-controlbox", "converse-muc", "converse-bookmarks"],
initialize () {
/* The initialize function gets called as soon as the plugin is
......@@ -285,5 +283,5 @@
_converse.api.listen.on('reconnected', initRoomsListView);
}
});
}));
});
// Converse.js
// http://conversejs.org
//
// Copyright (c) 2012-2018, the Converse.js developers
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define(["@converse/headless/converse-core"], factory);
}(this, function (converse) {
"use strict";
const { Backbone, Promise, Strophe, $iq, $pres, b64_sha1, moment, sizzle, _ } = converse.env;
const u = converse.env.utils;
import converse from "@converse/headless/converse-core";
converse.plugins.add('converse-roster', {
const { Backbone, Promise, Strophe, $iq, $pres, b64_sha1, moment, sizzle, _ } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-roster', {
dependencies: ["converse-vcard"],
......@@ -933,5 +931,5 @@
}
});
}
});
}));
});
// Converse.js
// http://conversejs.org
//
// Copyright (c) 2012-2018, the Converse.js developers
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define(["@converse/headless/converse-core",
"formdata-polyfill",
"templates/add_contact_modal.html",
"templates/group_header.html",
"templates/pending_contact.html",
"templates/requesting_contact.html",
"templates/roster.html",
"templates/roster_filter.html",
"templates/roster_item.html",
"templates/search_contact.html",
"awesomplete",
"@converse/headless/converse-chatboxes",
"converse-modal"
], factory);
}(this, function (
converse,
_FormData,
tpl_add_contact_modal,
tpl_group_header,
tpl_pending_contact,
tpl_requesting_contact,
tpl_roster,
tpl_roster_filter,
tpl_roster_item,
tpl_search_contact,
Awesomplete
) {
"use strict";
const { Backbone, Strophe, $iq, b64_sha1, sizzle, _ } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-rosterview', {
import "@converse/headless/converse-chatboxes";
import "converse-modal";
import Awesomplete from "awesomplete";
import _FormData from "formdata-polyfill";
import converse from "@converse/headless/converse-core";
import tpl_add_contact_modal from "templates/add_contact_modal.html";
import tpl_group_header from "templates/group_header.html";
import tpl_pending_contact from "templates/pending_contact.html";
import tpl_requesting_contact from "templates/requesting_contact.html";
import tpl_roster from "templates/roster.html";
import tpl_roster_filter from "templates/roster_filter.html";
import tpl_roster_item from "templates/roster_item.html";
import tpl_search_contact from "templates/search_contact.html";
const { Backbone, Strophe, $iq, b64_sha1, sizzle, _ } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-rosterview', {
dependencies: ["converse-roster", "converse-modal"],
......@@ -999,5 +984,5 @@
_converse.api.listen.on('rosterInitialized', initRoster);
_converse.api.listen.on('rosterReadyAfterReconnection', initRoster);
}
});
}));
});
// Converse.js
// http://conversejs.org
//
// Copyright (c) 2012-2018, the Converse.js developers
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
/* converse-singleton
......@@ -13,26 +13,23 @@
*
* This plugin makes sense in mobile or fullscreen chat environments (as
* configured by the `view_mode` setting).
*
*/
(function (root, factory) {
define(
["@converse/headless/converse-core", "converse-chatview"],
factory);
}(this, function (converse) {
"use strict";
const { _, Strophe } = converse.env;
const u = converse.env.utils;
import "converse-chatview";
import converse from "@converse/headless/converse-core";
const { _, Strophe } = converse.env;
const u = converse.env.utils;
function hideChat (view) {
function hideChat (view) {
if (view.model.get('id') === 'controlbox') { return; }
u.safeSave(view.model, {'hidden': true});
view.hide();
}
}
converse.plugins.add('converse-singleton', {
converse.plugins.add('converse-singleton', {
// It's possible however to make optional dependencies non-optional.
// If the setting "strict_plugin_dependencies" is set to true,
// an error will be raised if the plugin is not found.
......@@ -114,5 +111,5 @@
}
}
}
});
}));
});
/*global module, exports, _ */
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
......@@ -48,9 +50,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/******/ })([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
......@@ -71,7 +71,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (typeof _ == 'function' && typeof _.runInContext == 'function') {
// XXX: Customization in order to be able to run both _ and fp in the
// non-AMD usecase.
fp = browserConvert(_.runInContext());
window.fp = browserConvert(_.runInContext());
}
module.exports = browserConvert;
......@@ -227,8 +227,8 @@ return /******/ (function(modules) { // webpackBootstrap
func = name;
name = undefined;
}
if (func == null) {
throw new TypeError;
if (func === null) {
throw new TypeError();
}
options || (options = {});
......@@ -433,11 +433,11 @@ return /******/ (function(modules) { // webpackBootstrap
result = clone(Object(object)),
nested = result;
while (nested != null && ++index < length) {
while (nested !== null && ++index < length) {
var key = path[index],
value = nested[key];
if (value != null) {
if (value !== null) {
nested[path[index]] = clone(index == lastIndex ? value : Object(value));
}
nested = nested[key];
......@@ -934,6 +934,7 @@ return /******/ (function(modules) { // webpackBootstrap
result = {};
for (var key in object) {
if (Object.prototype.hasOwnProperty.call(object, key)) {
var value = object[key];
if (hasOwnProperty.call(result, value)) {
result[value].push(key);
......@@ -941,6 +942,7 @@ return /******/ (function(modules) { // webpackBootstrap
result[value] = [key];
}
}
}
return result;
}());
......@@ -1034,9 +1036,6 @@ return /******/ (function(modules) { // webpackBootstrap
* @type {Object}
*/
module.exports = {};
/***/ }
/******/ ])
});
;
......@@ -4,24 +4,19 @@
// Copyright (c) 2012-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define([
"./converse-core",
"filesize",
"./utils/form",
"./utils/emoji"
], factory);
}(this, function (converse, filesize) {
"use strict";
import "./utils/emoji";
import "./utils/form";
import converse from "./converse-core";
import filesize from "filesize";
const { $msg, Backbone, Promise, Strophe, b64_sha1, moment, sizzle, utils, _ } = converse.env;
const u = converse.env.utils;
const { $msg, Backbone, Promise, Strophe, b64_sha1, moment, sizzle, utils, _ } = converse.env;
const u = converse.env.utils;
Strophe.addNamespace('MESSAGE_CORRECT', 'urn:xmpp:message-correct:0');
Strophe.addNamespace('REFERENCE', 'urn:xmpp:reference:0');
Strophe.addNamespace('MESSAGE_CORRECT', 'urn:xmpp:message-correct:0');
Strophe.addNamespace('REFERENCE', 'urn:xmpp:reference:0');
converse.plugins.add('converse-chatboxes', {
converse.plugins.add('converse-chatboxes', {
dependencies: ["converse-roster", "converse-vcard"],
......@@ -953,6 +948,4 @@
});
/************************ END API ************************/
}
});
return converse;
}));
});
This diff is collapsed.
......@@ -6,13 +6,12 @@
/* This is a Converse plugin which add support for XEP-0030: Service Discovery */
(function (root, factory) {
define(["./converse-core", "sizzle"], factory);
}(this, function (converse, sizzle) {
import converse from "./converse-core";
import sizzle from "sizzle";
const { Backbone, Promise, Strophe, $iq, b64_sha1, utils, _, f } = converse.env;
const { Backbone, Promise, Strophe, $iq, b64_sha1, utils, _, f } = converse.env;
converse.plugins.add('converse-disco', {
converse.plugins.add('converse-disco', {
initialize () {
/* The initialize function gets called as soon as the plugin is
......@@ -682,5 +681,4 @@
}
});
}
});
}));
});
......@@ -8,24 +8,22 @@
// XEP-0059 Result Set Management
(function (root, factory) {
define(["sizzle",
"./converse-core",
"./converse-disco",
"strophejs-plugin-rsm"
], factory);
}(this, function (sizzle, converse) {
"use strict";
const CHATROOMS_TYPE = 'chatroom';
const { Promise, Strophe, $iq, _, moment } = converse.env;
const u = converse.env.utils;
const RSM_ATTRIBUTES = ['max', 'first', 'last', 'after', 'before', 'index', 'count'];
// XEP-0313 Message Archive Management
const MAM_ATTRIBUTES = ['with', 'start', 'end'];
function getMessageArchiveID (stanza) {
import "./converse-disco";
import "strophejs-plugin-rsm";
import converse from "./converse-core";
import sizzle from "sizzle";
const CHATROOMS_TYPE = 'chatroom';
const { Promise, Strophe, $iq, _, moment } = converse.env;
const u = converse.env.utils;
const RSM_ATTRIBUTES = ['max', 'first', 'last', 'after', 'before', 'index', 'count'];
// XEP-0313 Message Archive Management
const MAM_ATTRIBUTES = ['with', 'start', 'end'];
function getMessageArchiveID (stanza) {
// See https://xmpp.org/extensions/xep-0313.html#results
//
// The result messages MUST contain a <result/> element with an 'id'
......@@ -39,9 +37,9 @@
if (!_.isUndefined(stanza_id)) {
return stanza_id.getAttribute('id');
}
}
}
function queryForArchivedMessages (_converse, options, callback, errback) {
function queryForArchivedMessages (_converse, options, callback, errback) {
/* Internal function, called by the "archive.query" API method.
*/
let date;
......@@ -121,10 +119,10 @@
},
_converse.message_archiving_timeout
);
}
}
converse.plugins.add('converse-mam', {
converse.plugins.add('converse-mam', {
dependencies: ['converse-chatview', 'converse-muc', 'converse-muc-views'],
......@@ -592,5 +590,4 @@
}
});
}
});
}));
});
......@@ -4,56 +4,51 @@
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define([
"./utils/form",
"./converse-core",
"./converse-disco",
"backbone.overview/backbone.overview",
"backbone.overview/backbone.orderedlistview",
"backbone.vdomview",
"./utils/muc",
"./utils/emoji"
], factory);
}(this, function (u, converse) {
"use strict";
const MUC_ROLE_WEIGHTS = {
import "./converse-disco";
import "./utils/emoji";
import "./utils/muc";
import "backbone.overview/backbone.orderedlistview";
import "backbone.overview/backbone.overview";
import "backbone.vdomview";
import converse from "./converse-core";
import u from "./utils/form";
const MUC_ROLE_WEIGHTS = {
'moderator': 1,
'participant': 2,
'visitor': 3,
'none': 2,
};
};
const { Strophe, Backbone, Promise, $iq, $build, $msg, $pres, b64_sha1, sizzle, f, moment, _ } = converse.env;
const { Strophe, Backbone, Promise, $iq, $build, $msg, $pres, b64_sha1, sizzle, f, moment, _ } = converse.env;
// Add Strophe Namespaces
Strophe.addNamespace('MUC_ADMIN', Strophe.NS.MUC + "#admin");
Strophe.addNamespace('MUC_OWNER', Strophe.NS.MUC + "#owner");
Strophe.addNamespace('MUC_REGISTER', "jabber:iq:register");
Strophe.addNamespace('MUC_ROOMCONF', Strophe.NS.MUC + "#roomconfig");
Strophe.addNamespace('MUC_USER', Strophe.NS.MUC + "#user");
// Add Strophe Namespaces
Strophe.addNamespace('MUC_ADMIN', Strophe.NS.MUC + "#admin");
Strophe.addNamespace('MUC_OWNER', Strophe.NS.MUC + "#owner");
Strophe.addNamespace('MUC_REGISTER', "jabber:iq:register");
Strophe.addNamespace('MUC_ROOMCONF', Strophe.NS.MUC + "#roomconfig");
Strophe.addNamespace('MUC_USER', Strophe.NS.MUC + "#user");
converse.MUC_NICK_CHANGED_CODE = "303";
converse.MUC_NICK_CHANGED_CODE = "303";
converse.ROOM_FEATURES = [
converse.ROOM_FEATURES = [
'passwordprotected', 'unsecured', 'hidden',
'publicroom', 'membersonly', 'open', 'persistent',
'temporary', 'nonanonymous', 'semianonymous',
'moderated', 'unmoderated', 'mam_enabled'
];
];
converse.ROOMSTATUS = {
converse.ROOMSTATUS = {
CONNECTED: 0,
CONNECTING: 1,
NICKNAME_REQUIRED: 2,
PASSWORD_REQUIRED: 3,
DISCONNECTED: 4,
ENTERED: 5
};
};
converse.plugins.add('converse-muc', {
converse.plugins.add('converse-muc', {
/* Optional dependencies are other plugins which might be
* overridden or relied upon, and therefore need to be loaded before
* this plugin. They are called "optional" because they might not be
......@@ -1458,20 +1453,17 @@
* true
* );
*/
'open' (jids, attrs) {
return new Promise((resolve, reject) => {
_converse.api.waitUntil('chatBoxesFetched').then(() => {
'open': async function (jids, attrs) {
await _converse.api.waitUntil('chatBoxesFetched');
if (_.isUndefined(jids)) {
const err_msg = 'rooms.open: You need to provide at least one JID';
_converse.log(err_msg, Strophe.LogLevel.ERROR);
reject(new TypeError(err_msg));
throw(new TypeError(err_msg));
} else if (_.isString(jids)) {
resolve(_converse.api.rooms.create(jids, attrs).trigger('show'));
return _converse.api.rooms.create(jids, attrs).trigger('show');
} else {
resolve(_.map(jids, (jid) => _converse.api.rooms.create(jid, attrs).trigger('show')));
return _.map(jids, (jid) => _converse.api.rooms.create(jid, attrs).trigger('show'));
}
});
});
},
/**
......@@ -1524,5 +1516,4 @@
});
/************************ END API ************************/
}
});
}));
});
......@@ -7,14 +7,14 @@
/* This is a Converse.js plugin which add support for application-level pings
* as specified in XEP-0199 XMPP Ping.
*/
(function (root, factory) {
define(["./converse-core", "strophejs-plugin-ping"], factory);
}(this, function (converse) {
"use strict";
// Strophe methods for building stanzas
const { Strophe, _ } = converse.env;
converse.plugins.add('converse-ping', {
import "strophejs-plugin-ping";
import converse from "./converse-core";
// Strophe methods for building stanzas
const { Strophe, _ } = converse.env;
converse.plugins.add('converse-ping', {
initialize () {
/* The initialize function gets called as soon as the plugin is
......@@ -90,5 +90,4 @@
_converse.on('connected', onConnected);
_converse.on('reconnected', onConnected);
}
});
}));
});
......@@ -4,15 +4,15 @@
// Copyright (c) 2013-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define(["./converse-core", "./templates/vcard.html"], factory);
}(this, function (converse, tpl_vcard) {
"use strict";
const { Backbone, Promise, Strophe, _, $iq, $build, b64_sha1, moment, sizzle } = converse.env;
const u = converse.env.utils;
import converse from "./converse-core";
import tpl_vcard from "./templates/vcard.html";
converse.plugins.add('converse-vcard', {
const { Backbone, Promise, Strophe, _, $iq, $build, b64_sha1, moment, sizzle } = converse.env;
const u = converse.env.utils;
converse.plugins.add('converse-vcard', {
initialize () {
/* The initialize function gets called as soon as the plugin is
......@@ -239,5 +239,4 @@
}
});
}
});
}));
});
This diff is collapsed.
This diff is collapsed.
......@@ -5,18 +5,12 @@
//
// Copyright (c) 2013-2018, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define */
(function (root, factory) {
define([
"../lodash.noconflict",
"./core",
"../templates/field.html"
], factory);
}(this, function (_, u, tpl_field) {
"use strict";
u.webForm2xForm = function (field) {
import _ from "../lodash.noconflict";
import tpl_field from "../templates/field.html";
import u from "./core";
u.webForm2xForm = function (field) {
/* Takes an HTML DOM and turns it into an XForm field.
*
* Parameters:
......@@ -38,6 +32,5 @@
'value': value
})
);
};
return u;
}));
};
export default u;
......@@ -3,18 +3,19 @@
//
// This is the utilities module.
//
// Copyright (c) 2012-2017, Jan-Carel Brand <jc@opkode.com>
// Copyright (c) 2013-2018, Jan-Carel Brand <jc@opkode.com>
// Licensed under the Mozilla Public License (MPLv2)
//
/*global define, escape, Jed */
(function (root, factory) {
define(["../converse-core", "./core"], factory);
}(this, function (converse, u) {
"use strict";
/*global escape, Jed */
const { Strophe, sizzle, _ } = converse.env;
u.computeAffiliationsDelta = function computeAffiliationsDelta (exclude_existing, remove_absentees, new_list, old_list) {
import converse from "@converse/headless/converse-core";
import u from "./core";
const { Strophe, sizzle, _ } = converse.env;
u.computeAffiliationsDelta = function computeAffiliationsDelta (exclude_existing, remove_absentees, new_list, old_list) {
/* Given two lists of objects with 'jid', 'affiliation' and
* 'reason' properties, return a new list containing
* those objects that are new, changed or removed
......@@ -69,9 +70,9 @@
);
}
return delta;
};
};
u.parseMemberListIQ = function parseMemberListIQ (iq) {
u.parseMemberListIQ = function parseMemberListIQ (iq) {
/* Given an IQ stanza with a member list, create an array of member objects.
*/
return _.map(
......@@ -99,5 +100,5 @@
return data;
}
);
};
}));
};
This diff is collapsed.
......@@ -112,6 +112,8 @@
modal.el.querySelector('input[name="chatroom"]').value = jid;
modal.el.querySelector('input[name="nickname"]').value = nick;
modal.el.querySelector('form input[type="submit"]').click();
await utils.waitUntil(() => _converse.chatboxviews.get(jid), 1000);
return _converse.chatboxviews.get(jid);
};
utils.openChatRoom = function (_converse, room, server, nick) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment