Add permission for chat

This commit is contained in:
calzoneman 2013-06-20 15:02:53 -04:00
parent d363b1560e
commit 59df3924f8
2 changed files with 9 additions and 2 deletions

View File

@ -68,7 +68,8 @@ var Channel = function(name) {
ban: 2, ban: 2,
motdedit: 3, motdedit: 3,
filteredit: 3, filteredit: 3,
drink: 1.5 drink: 1.5,
chat: 0
}; };
this.opts = { this.opts = {
allow_voteskip: true, allow_voteskip: true,
@ -1710,7 +1711,10 @@ Channel.prototype.tryChat = function(user, data) {
return; return;
} }
if(data.msg == undefined) { if(!this.hasPermission(user, "chat"))
return;
if(typeof data.msg !== "string") {
return; return;
} }

View File

@ -762,6 +762,8 @@ function handlePermissionChange() {
for(var i = 0; i < users.length; i++) { for(var i = 0; i < users.length; i++) {
addUserDropdown($(users[i]), users[i].children[1].innerHTML); addUserDropdown($(users[i]), users[i].children[1].innerHTML);
} }
$("#chatline").attr("disabled", !hasPermission("chat"));
rebuildPlaylist(); rebuildPlaylist();
} }
@ -1195,6 +1197,7 @@ function genPermissionsEditor() {
addDivider("Misc"); addDivider("Misc");
makeOption("Drink calls", "drink", modleader, CHANNEL.perms.drink+""); makeOption("Drink calls", "drink", modleader, CHANNEL.perms.drink+"");
makeOption("Chat", "chat", standard, CHANNEL.perms.chat+"");
var submit = $("<button/>").addClass("btn btn-primary").appendTo(fs); var submit = $("<button/>").addClass("btn btn-primary").appendTo(fs);
submit.text("Save"); submit.text("Save");