Add prompt for kick/ban reason

This commit is contained in:
calzoneman 2014-01-20 17:35:55 -06:00
parent e075d2f95a
commit 24fcce3f87
3 changed files with 22 additions and 7 deletions

View File

@ -663,7 +663,7 @@ Channel.prototype.handleNameBan = function (actor, name, reason) {
if (err) { if (err) {
actor.socket.emit("errorMsg", { actor.socket.emit("errorMsg", {
msg: "Internal error " + err msg: "Internal error: " + err
}); });
return; return;
} }

View File

@ -295,13 +295,25 @@ function handleKick(chan, user, args) {
} }
function handleIPBan(chan, user, args) { function handleIPBan(chan, user, args) {
chan.handleBanAllIP(user, args[0], "", args[1]); var name = args.shift();
var range = args.shift();
var reason;
if (range !== "range") {
reason = range + " " + args.join(" ");
range = false;
} else {
reason = args.join(" ");
range = true;
}
chan.handleBanAllIP(user, name, reason, range);
// Ban the name too for good measure // Ban the name too for good measure
chan.handleNameBan(user, args[0], ""); chan.handleNameBan(user, name, reason);
} }
function handleBan(chan, user, args) { function handleBan(chan, user, args) {
chan.handleNameBan(user, args[0], ""); var name = args.shift();
var reason = args.join(" ");
chan.handleNameBan(user, name, reason);
} }
function handleUnban(chan, user, args) { function handleUnban(chan, user, args) {

View File

@ -216,8 +216,9 @@ function addUserDropdown(entry) {
$("<button/>").addClass("btn btn-xs btn-default") $("<button/>").addClass("btn btn-xs btn-default")
.text("Kick") .text("Kick")
.click(function () { .click(function () {
var reason = prompt("Enter kick reason (optional)");
socket.emit("chatMsg", { socket.emit("chatMsg", {
msg: "/kick " + name msg: "/kick " + name + " " + reason
}); });
}) })
.appendTo(btngroup); .appendTo(btngroup);
@ -271,16 +272,18 @@ function addUserDropdown(entry) {
$("<button/>").addClass("btn btn-xs btn-default") $("<button/>").addClass("btn btn-xs btn-default")
.text("Name Ban") .text("Name Ban")
.click(function () { .click(function () {
var reason = prompt("Enter ban reason (optional)");
socket.emit("chatMsg", { socket.emit("chatMsg", {
msg: "/ban " + name msg: "/ban " + name + " " + reason
}); });
}) })
.appendTo(btngroup); .appendTo(btngroup);
$("<button/>").addClass("btn btn-xs btn-default") $("<button/>").addClass("btn btn-xs btn-default")
.text("IP Ban") .text("IP Ban")
.click(function () { .click(function () {
var reason = prompt("Enter ban reason (optional)");
socket.emit("chatMsg", { socket.emit("chatMsg", {
msg: "/ipban " + name msg: "/ipban " + name + " " + reason
}); });
}) })
.appendTo(btngroup); .appendTo(btngroup);