diff --git a/clientapp/models/muc.js b/clientapp/models/muc.js index d5cd1cd..ba9658d 100644 --- a/clientapp/models/muc.js +++ b/clientapp/models/muc.js @@ -134,7 +134,7 @@ module.exports = HumanModel.define({ this.lastInteraction = newInteraction; } }, - join: function () { + join: function (manual) { if (!this.nick) { this.nick = me.jid.local; } @@ -149,6 +149,39 @@ module.exports = HumanModel.define({ } }); + if (manual) { + var form = { + fields: [ + { + type: 'hidden', + name: 'FORM_TYPE', + value: 'http://jabber.org/protocol/muc#roomconfig' + }, + { + type: 'boolean', + name: 'muc#roomconfig_changesubject', + value: true + }, + { + type: 'boolean', + name: 'muc#roomconfig_persistentroom', + value: true + }, + ] + }; + client.configureRoom(this.jid, form, function(err, resp) { + if (err) return; + }); + + if (SERVER_CONFIG.domain && SERVER_CONFIG.admin) { + var self = this; + client.setRoomAffiliation(this.jid, SERVER_CONFIG.admin + '@' + SERVER_CONFIG.domain, 'owner', 'administration', function(err, resp) { + if (err) return; + client.setRoomAffiliation(self.jid, me.jid, 'none', 'administration'); + }); + } + } + var self = this; // After a reconnection client.on('muc:join', function (pres) { diff --git a/clientapp/views/main.js b/clientapp/views/main.js index b98214d..df69aa3 100644 --- a/clientapp/views/main.js +++ b/clientapp/views/main.js @@ -137,7 +137,7 @@ module.exports = HumanView.extend({ autoJoin: true }); me.mucs.save(); - me.mucs.get(mucjid).join(); + me.mucs.get(mucjid).join(true); }, keyDownJoinMUC: function (e) { if (e.which === 13 && !e.shiftKey) { diff --git a/dev_config.json b/dev_config.json index 7fbe4ee..2189e53 100644 --- a/dev_config.json +++ b/dev_config.json @@ -14,6 +14,7 @@ "domain": "localhost", "wss": "wss://localhost:5281/xmpp-websocket/", "muc": "chat.localhost", - "startup": "" + "startup": "", + "admin": "" } }