mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-11-24 18:22:21 -05:00
Owner can destroy rooms
This commit is contained in:
parent
882dfad1a8
commit
f06f9aa4ad
@ -279,5 +279,19 @@ module.exports = HumanModel.define({
|
|||||||
leave: function () {
|
leave: function () {
|
||||||
this.resources.reset();
|
this.resources.reset();
|
||||||
client.leaveRoom(this.jid, this.nick);
|
client.leaveRoom(this.jid, this.nick);
|
||||||
|
},
|
||||||
|
destroy: function (cb) {
|
||||||
|
client.sendIq({
|
||||||
|
type: 'set',
|
||||||
|
to: this.jid,
|
||||||
|
mucOwner: {
|
||||||
|
destroy: {
|
||||||
|
jid: this.jid,
|
||||||
|
password: '',
|
||||||
|
reason: ''
|
||||||
|
} }
|
||||||
|
}, function (err, res) {
|
||||||
|
cb(err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -21,7 +21,7 @@ module.exports = HumanView.extend({
|
|||||||
events: {
|
events: {
|
||||||
'click': 'handleClick',
|
'click': 'handleClick',
|
||||||
'click .join': 'handleJoinRoom',
|
'click .join': 'handleJoinRoom',
|
||||||
'click .remove': 'handleLeaveRoom'
|
'click .remove': 'handleDestroyRoom'
|
||||||
},
|
},
|
||||||
render: function () {
|
render: function () {
|
||||||
this.renderAndBind({contact: this.model});
|
this.renderAndBind({contact: this.model});
|
||||||
@ -33,7 +33,22 @@ module.exports = HumanView.extend({
|
|||||||
handleJoinRoom: function (e) {
|
handleJoinRoom: function (e) {
|
||||||
this.model.join();
|
this.model.join();
|
||||||
},
|
},
|
||||||
handleLeaveRoom: function (e) {
|
handleDestroyRoom: function (e) {
|
||||||
this.model.leave();
|
var muc = this.model;
|
||||||
|
|
||||||
|
$.prompt('Are you sure you want to remove this room: ' + muc.displayName + '?', {
|
||||||
|
title: 'Remove Room',
|
||||||
|
buttons: { "Yes": true, "Cancel": false },
|
||||||
|
persistent: true,
|
||||||
|
submit:function (e, v, m, f) {
|
||||||
|
if (v) {
|
||||||
|
muc.destroy(function (err) {
|
||||||
|
if (err) {
|
||||||
|
$.prompt(err.error.text, { title: 'Remove Room' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user