mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-08-13 17:03:51 -04:00
MUCs: Join persistents rooms
This commit is contained in:
parent
424be688f9
commit
44c9235ea2
@ -134,7 +134,7 @@ module.exports = HumanModel.define({
|
|||||||
this.lastInteraction = newInteraction;
|
this.lastInteraction = newInteraction;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
join: function () {
|
join: function (manual) {
|
||||||
if (!this.nick) {
|
if (!this.nick) {
|
||||||
this.nick = me.jid.local;
|
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;
|
var self = this;
|
||||||
// After a reconnection
|
// After a reconnection
|
||||||
client.on('muc:join', function (pres) {
|
client.on('muc:join', function (pres) {
|
||||||
|
@ -137,7 +137,7 @@ module.exports = HumanView.extend({
|
|||||||
autoJoin: true
|
autoJoin: true
|
||||||
});
|
});
|
||||||
me.mucs.save();
|
me.mucs.save();
|
||||||
me.mucs.get(mucjid).join();
|
me.mucs.get(mucjid).join(true);
|
||||||
},
|
},
|
||||||
keyDownJoinMUC: function (e) {
|
keyDownJoinMUC: function (e) {
|
||||||
if (e.which === 13 && !e.shiftKey) {
|
if (e.which === 13 && !e.shiftKey) {
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
"domain": "localhost",
|
"domain": "localhost",
|
||||||
"wss": "wss://localhost:5281/xmpp-websocket/",
|
"wss": "wss://localhost:5281/xmpp-websocket/",
|
||||||
"muc": "chat.localhost",
|
"muc": "chat.localhost",
|
||||||
"startup": ""
|
"startup": "",
|
||||||
|
"admin": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user