|
@@ -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-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;
|
|
|
+// 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.
|
|
|
+ */
|
|
|
+ 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.");
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
-}
|
|
|
+}));
|