1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2024-11-05 17:15:04 -05:00

MUCs: Join persistents rooms

This commit is contained in:
Sébastien Hut 2015-02-27 19:39:48 +01:00
parent 424be688f9
commit 44c9235ea2
3 changed files with 37 additions and 3 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -14,6 +14,7 @@
"domain": "localhost",
"wss": "wss://localhost:5281/xmpp-websocket/",
"muc": "chat.localhost",
"startup": ""
"startup": "",
"admin": ""
}
}