Commit 66d80cc4 authored by JC Brand's avatar JC Brand

New configuration setting `muc_instant_rooms`.

This option is by default set to `true` which entails no changes in behavior
compared to previous versions of converse.js.

If set to `false`, then rooms first need to be configured before they can be
joined by other users (so-called "reserved" rooms).

More info on "instant" and "reserved" rooms here:
http://xmpp.org/extensions/xep-0045.html#createroom
parent cd46e967
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
## 1.0.6 (Unreleased) ## 1.0.6 (Unreleased)
- #674 Polish translation updated to the current master. [ser] - #674 Polish translation updated to the current master. [ser]
- New config option [muc_nickname_from_jid](https://conversejs.org/docs/html/configuration.html#muc_nickname_from_jid) [jcbrand] - New config option [muc_nickname_from_jid](https://conversejs.org/docs/html/configuration.html#muc_nickname_from_jid) [jcbrand]
- New config option [muc_instant_rooms](https://conversejs.org/docs/html/configuration.html#muc_instant_rooms) [jcbrand]
## 1.0.5 (2016-07-28) ## 1.0.5 (2016-07-28)
- In case of nickname conflict when joining a room, allow the user to choose a new one. - In case of nickname conflict when joining a room, allow the user to choose a new one.
......
...@@ -639,6 +639,19 @@ different approach. ...@@ -639,6 +639,19 @@ different approach.
If you're using MAM for archiving chat room messages, you might want to set If you're using MAM for archiving chat room messages, you might want to set
this option to zero. this option to zero.
muc_instant_rooms
------------------
* Default: ``true``
Determines whether 'instant' (also called 'dynamic' in OpenFire) rooms are created.
Otherwise rooms first have to be configured before they're available to other
users (so-called "registered rooms" in `MUC-0045 <http://xmpp.org/extensions/xep-0045.html#createroom>`_).
From a UX perspective, if this settings is `false`, then a configuration form will
render, that has to be filled in first, before the room can be joined by other
users.
muc_nickname_from_jid muc_nickname_from_jid
--------------------- ---------------------
......
...@@ -156,16 +156,19 @@ ...@@ -156,16 +156,19 @@
*/ */
var converse = this.converse; var converse = this.converse;
// Configuration values for this plugin // Configuration values for this plugin
// ====================================
// Refer to docs/source/configuration.rst for explanations of these
// configuration settings.
this.updateSettings({ this.updateSettings({
allow_muc_invitations: true,
allow_muc: true, allow_muc: true,
muc_nickname_from_jid: false, // Use the node part of the user's JID as room nickname allow_muc_invitations: true,
auto_join_on_invite: false, // Auto-join chatroom on invite auto_join_on_invite: false,
auto_join_rooms: [], // List of maps {'jid': 'room@example.org', 'nick': 'WizardKing69' }, auto_join_rooms: [],
// providing room jids and nicks or simply a list JIDs.
auto_list_rooms: false, auto_list_rooms: false,
hide_muc_server: false, hide_muc_server: false,
muc_history_max_stanzas: undefined, // Takes an integer, limits the amount of messages to fetch from chat room's history muc_history_max_stanzas: undefined,
muc_instant_rooms: true,
muc_nickname_from_jid: false,
show_toolbar: true, show_toolbar: true,
}); });
...@@ -202,6 +205,7 @@ ...@@ -202,6 +205,7 @@
var id = b64_sha1('converse.occupants'+converse.bare_jid+this.model.get('id')+this.model.get('nick')); var id = b64_sha1('converse.occupants'+converse.bare_jid+this.model.get('id')+this.model.get('nick'));
this.occupantsview.model.browserStorage = new Backbone.BrowserStorage[converse.storage](id); this.occupantsview.model.browserStorage = new Backbone.BrowserStorage[converse.storage](id);
this.occupantsview.chatroomview = this; this.occupantsview.chatroomview = this;
this.render().$el.hide(); this.render().$el.hide();
this.occupantsview.model.fetch({add:true}); this.occupantsview.model.fetch({add:true});
var nick = this.model.get('nick'); var nick = this.model.get('nick');
...@@ -648,7 +652,9 @@ ...@@ -648,7 +652,9 @@
}, },
configureChatRoom: function (ev) { configureChatRoom: function (ev) {
if (typeof ev !== 'undefined' && ev.preventDefault) {
ev.preventDefault(); ev.preventDefault();
}
if (this.$el.find('div.chatroom-form-container').length) { if (this.$el.find('div.chatroom-form-container').length) {
return; return;
} }
...@@ -875,8 +881,7 @@ ...@@ -875,8 +881,7 @@
* Allow user to configure chat room if they are the owner. * Allow user to configure chat room if they are the owner.
* See: http://xmpp.org/registrar/mucstatus.html * See: http://xmpp.org/registrar/mucstatus.html
*/ */
var $el = $(el), var $el = $(el), i, disconnect_msgs = [], msgs = [], reasons = [];
i, disconnect_msgs = [], msgs = [], reasons = [];
$el.find('x[xmlns="'+Strophe.NS.MUC_USER+'"]').each(function (idx, x) { $el.find('x[xmlns="'+Strophe.NS.MUC_USER+'"]').each(function (idx, x) {
var $item = $(x).find('item'); var $item = $(x).find('item');
...@@ -996,7 +1001,11 @@ ...@@ -996,7 +1001,11 @@
if (this.model.get('connection_status') !== Strophe.Status.CONNECTED) { if (this.model.get('connection_status') !== Strophe.Status.CONNECTED) {
this.model.set('connection_status', Strophe.Status.CONNECTED); this.model.set('connection_status', Strophe.Status.CONNECTED);
} }
if (converse.muc_instant_rooms) {
this.hideSpinner().showStatusMessages(pres, is_self); this.hideSpinner().showStatusMessages(pres, is_self);
} else {
this.configureChatRoom();
}
} }
this.occupantsview.updateOccupantsOnPresence(pres); this.occupantsview.updateOccupantsOnPresence(pres);
}, },
...@@ -1440,11 +1449,7 @@ ...@@ -1440,11 +1449,7 @@
createChatRoom: function (ev) { createChatRoom: function (ev) {
ev.preventDefault(); ev.preventDefault();
var name, $name, var name, $name, server, $server, jid, chatroom;
server, $server,
jid,
chatroom;
if (ev.type === 'click') { if (ev.type === 'click') {
name = $(ev.target).text(); name = $(ev.target).text();
jid = $(ev.target).attr('data-room-jid'); jid = $(ev.target).attr('data-room-jid');
......
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