Also allow a single-user chat to be embedded into the page

This commit is contained in:
JC Brand 2018-05-03 17:01:17 +02:00
parent 4c15ac2e8c
commit df948a8dd6
12 changed files with 79 additions and 107 deletions

View File

@ -185,8 +185,6 @@ BUILDS = dist/converse.js \
dist/converse.min.js \
dist/converse-headless.js \
dist/converse-headless.min.js \
dist/converse-muc-embedded.js \
dist/converse-muc-embedded.min.js \
dist/converse-no-dependencies.min.js \
dist/converse-no-dependencies.js
@ -209,10 +207,6 @@ dist/converse-no-dependencies.js: transpile src stamp-npm
$(RJS) -o src/build-no-dependencies.js optimize=none out=dist/converse-no-dependencies.js
dist/converse-no-dependencies.min.js: transpile src stamp-npm
$(RJS) -o src/build-no-dependencies.js out=dist/converse-no-dependencies.min.js
dist/converse-muc-embedded.js: transpile src stamp-npm
$(RJS) -o src/build.js paths.converse=src/converse-embedded include=converse out=dist/converse-muc-embedded.js optimize=none
dist/converse-muc-embedded.min.js: transpile src stamp-npm
$(RJS) -o src/build.js paths.converse=src/converse-embedded include=converse out=dist/converse-muc-embedded.min.js
.PHONY: dist
dist:: build

View File

@ -8628,21 +8628,23 @@ body.reset {
bottom: auto;
height: 100%;
width: 100%; }
#conversejs.converse-embedded .flyout {
bottom: 0; }
#conversejs.converse-embedded .chatroom {
#conversejs.converse-embedded .chatbox {
margin: 0;
height: 100%;
width: 100%; }
#conversejs.converse-embedded .chatbox .box-flyout {
#conversejs.converse-embedded .chatbox .flyout.box-flyout {
bottom: 0;
box-shadow: none;
height: 100%; }
height: 100%;
min-width: auto;
width: 100%; }
#conversejs.converse-embedded .chatbox .chat-title {
padding: 0.3em;
font-size: 120%; }
#conversejs.converse-embedded .chatbox-btn {
display: none; }
#conversejs.converse-embedded .chatroom .box-flyout {
min-width: auto;
#conversejs.converse-embedded .chatroom {
margin: 0;
width: 100%; }
#conversejs.converse-embedded .chatroom .box-flyout .occupants-heading {
font-size: 120%; }

View File

@ -65,6 +65,9 @@
notify_all_room_messages: [
'discuss@conference.conversejs.org'
],
auto_join_private_chats: [
'opkode@jappix.com'
],
auto_reconnect: true,
// bosh_service_url: 'http://chat.example.org:5280/http-bind/',
bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes

View File

@ -21,19 +21,19 @@
width: 100%;
}
.flyout {
bottom: 0;
}
.chatroom {
margin: 0;
width: 100%;
}
.chatbox {
.box-flyout {
margin: 0;
height: 100%;
width: 100%;
.flyout.box-flyout {
bottom: 0;
box-shadow: none;
height: 100%;
min-width: auto;
width: 100%;
}
.chat-title {
padding: 0.3em;
font-size: 120%;
@ -43,9 +43,9 @@
display: none;
}
.chatroom {
.box-flyout {
min-width: auto;
margin: 0;
width: 100%;
.box-flyout {
.occupants-heading {
font-size: 120%;
}

View File

@ -54,4 +54,4 @@
@import "converse/minimized_chats";
@import "bookmarks";
@import "awesomplete";
@import "muc_embedded";
@import "embedded";

View File

@ -28,12 +28,12 @@
"converse-core": "builds/converse-core",
"converse-disco": "builds/converse-disco",
"converse-dragresize": "builds/converse-dragresize",
"converse-headline": "builds/converse-headline",
"converse-embedded": "builds/converse-embedded",
"converse-fullscreen": "builds/converse-fullscreen",
"converse-headline": "builds/converse-headline",
"converse-mam": "builds/converse-mam",
"converse-minimize": "builds/converse-minimize",
"converse-muc": "builds/converse-muc",
"converse-muc-embedded": "builds/converse-muc-embedded",
"converse-notification": "builds/converse-notification",
"converse-otr": "builds/converse-otr",
"converse-ping": "builds/converse-ping",
@ -43,9 +43,9 @@
"converse-rosterview": "builds/converse-rosterview",
"converse-singleton": "builds/converse-singleton",
"converse-vcard": "builds/converse-vcard",
"form-utils": "builds/utils/form",
"i18n": "builds/i18n",
"utils": "builds/utils/core",
"form-utils": "builds/utils/form",
"muc-utils": "builds/utils/muc"
},
wrap: {

View File

@ -11,15 +11,14 @@
"converse-core": "builds/converse-core",
"converse-disco": "builds/converse-disco",
"converse-dragresize": "builds/converse-dragresize",
"converse-embedded": "builds/converse-embedded",
"converse-fullscreen": "builds/converse-fullscreen",
"converse-headline": "builds/converse-headline",
"converse-http-file-upload":"builds/converse-http-file-upload",
"converse-mam": "builds/converse-mam",
"converse-minimize": "builds/converse-minimize",
"converse-modal": "builds/converse-modal",
"converse-muc": "builds/converse-muc",
"converse-muc-views": "builds/converse-muc-views",
"converse-muc-embedded": "builds/converse-muc-embedded",
"converse-notification": "builds/converse-notification",
"converse-otr": "builds/converse-otr",
"converse-ping": "builds/converse-ping",
@ -29,10 +28,10 @@
"converse-rosterview": "builds/converse-rosterview",
"converse-singleton": "builds/converse-singleton",
"converse-vcard": "builds/converse-vcard",
"i18n": "builds/i18n",
"utils": "builds/utils/core",
"form-utils": "builds/utils/form",
"muc-utils": "builds/utils/muc"
"i18n": "builds/i18n",
"muc-utils": "builds/utils/muc",
"utils": "builds/utils/core"
},
wrap: {
startFile: "start.frag",

View File

@ -78,6 +78,7 @@ require.config({
"converse-core": "src/converse-core",
"converse-disco": "src/converse-disco",
"converse-dragresize": "src/converse-dragresize",
"converse-embedded": "src/converse-embedded",
"converse-fullscreen": "src/converse-fullscreen",
"converse-headline": "src/converse-headline",
"converse-mam": "src/converse-mam",
@ -85,7 +86,6 @@ require.config({
"converse-minimize": "src/converse-minimize",
"converse-modal": "src/converse-modal",
"converse-muc": "src/converse-muc",
"converse-muc-embedded": "src/converse-muc-embedded",
"converse-muc-views": "src/converse-muc-views",
"converse-notification": "src/converse-notification",
"converse-otr": "src/converse-otr",

View File

@ -77,7 +77,7 @@
'converse-core',
'converse-disco',
'converse-dragresize',
'converse-dropdown',
'converse-embedded',
'converse-fullscreen',
'converse-headline',
'converse-http-file-upload',
@ -86,7 +86,6 @@
'converse-minimize',
'converse-modal',
'converse-muc',
'converse-muc-embedded',
'converse-muc-views',
'converse-notification',
'converse-otr',
@ -1848,12 +1847,8 @@
_.forEach([ // eslint-disable-line lodash/prefer-map
"converse-bookmarks",
"converse-controlbox",
"converse-dragresize",
"converse-headline",
"converse-minimize",
"converse-otr",
"converse-register",
"converse-vcard",
"converse-register"
], (name) => {
_converse.blacklisted_plugins.push(name)
});

View File

@ -1,20 +1,41 @@
/*global define */
if (typeof define !== 'undefined') {
// The section below determines which plugins will be included in a build
define([
"converse-core",
/* START: Removable components
* --------------------
* Any of the following components may be removed if they're not needed.
// Converse.js
// http://conversejs.org
//
// Copyright (c) 2012-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define(["converse-core", "converse-muc"], factory);
}(this, function (converse) {
"use strict";
const { Backbone, _ } = converse.env;
converse.plugins.add('converse-embedded', {
enabled (_converse) {
return _converse.view_mode === 'embedded';
},
initialize () {
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
"converse-chatview", // Renders standalone chat boxes for single user chat
"converse-mam", // XEP-0313 Message Archive Management
"converse-muc", // XEP-0045 Multi-user chat
"converse-muc-embedded",
"converse-ping", // XEP-0199 XMPP Ping
"converse-notification",// HTML5 Notifications
/* END: Removable components */
], function (converse) {
return converse;
this._converse.api.settings.update({
'allow_logout': false, // No point in logging out when we have auto_login as true.
'allow_muc_invitations': false, // Doesn't make sense to allow because only
// roster contacts can be invited
'hide_muc_server': true
});
}
const { _converse } = this;
if (!_.isArray(_converse.auto_join_rooms) && !_.isArray(_converse.auto_join_private_chats)) {
throw new Error("converse-embedded: auto_join_rooms must be an Array");
}
if (_converse.auto_join_rooms.length !== 1 && _converse.auto_join_private_chats.length !== 1) {
throw new Error("converse-embedded: It doesn't make "+
"sense to have the auto_join_rooms setting to zero or "+
"more then one, since only one chat room can be open "+
"at any time.");
}
}
});
}));

View File

@ -1,42 +0,0 @@
// Converse.js
// http://conversejs.org
//
// Copyright (c) 2012-2018, the Converse.js developers
// Licensed under the Mozilla Public License (MPLv2)
(function (root, factory) {
define(["converse-core", "converse-muc"], factory);
}(this, function (converse) {
"use strict";
const { Backbone, _ } = converse.env;
converse.plugins.add('converse-muc-embedded', {
enabled (_converse) {
return _converse.view_mode === 'embedded';
},
initialize () {
/* The initialize function gets called as soon as the plugin is
* loaded by converse.js's plugin machinery.
*/
this._converse.api.settings.update({
'allow_logout': false, // No point in logging out when we have auto_login as true.
'allow_muc_invitations': false, // Doesn't make sense to allow because only
// roster contacts can be invited
'hide_muc_server': true, // Federation is disabled, so no use in
// showing the MUC server.
});
const { _converse } = this;
if (!_.isArray(_converse.auto_join_rooms)) {
throw new Error("converse-muc-embedded: auto_join_rooms must be an Array");
}
if (_converse.auto_join_rooms.length !== 1) {
throw new Error("converse-muc-embedded: It doesn't make "+
"sense to have the auto_join_rooms setting to zero or "+
"more then one, since only one chat room can be open "+
"at any time.");
}
}
});
}));

View File

@ -11,12 +11,12 @@ if (typeof define !== 'undefined') {
"converse-chatview", // Renders standalone chat boxes for single user chat
"converse-controlbox", // The control box
"converse-dragresize", // Allows chat boxes to be resized by dragging them
"converse-embedded",
"converse-fullscreen",
"converse-headline", // Support for headline messages
"converse-mam", // XEP-0313 Message Archive Management
"converse-minimize", // Allows chat boxes to be minimized
"converse-muc", // XEP-0045 Multi-user chat
"converse-muc-embedded",
"converse-muc-views",
"converse-muc-views", // Views related to MUC
"converse-notification", // HTML5 Notifications