From d100936b65556d652dd2333e02ab0b9f4786fb3e Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sun, 18 Aug 2013 19:31:34 -0500 Subject: [PATCH] A couple fixes --- channel.js | 2 +- chatcommand.js | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/channel.js b/channel.js index de601cc0..466cf66d 100644 --- a/channel.js +++ b/channel.js @@ -525,7 +525,7 @@ Channel.prototype.tryNameBan = function(actor, name) { if(rank >= actor.rank) { actor.socket.emit("errorMsg", { - msg: "You don't have permission to ban this person." + msg: "You don't have permission to ban " + name }); return; } diff --git a/chatcommand.js b/chatcommand.js index 388bee42..1ad2d946 100644 --- a/chatcommand.js +++ b/chatcommand.js @@ -145,10 +145,21 @@ function handleUnmute(chan, user, args) { function handleKick(chan, user, args) { if(chan.hasPermission(user, "kick") && args.length > 0) { args[0] = args[0].toLowerCase(); + if(args[0] == user.name.toLowerCase()) { + user.socket.emit("costanza", { + msg: "Kicking yourself?" + }); + return; + } var kickee; for(var i = 0; i < chan.users.length; i++) { - if(chan.users[i].name.toLowerCase() == args[0] && - chan.getRank(chan.users[i].name) < user.rank) { + if(chan.users[i].name.toLowerCase() == args[0]) { + if(chan.users[i].rank >= user.rank) { + user.socket.emit("errorMsg", { + msg: "You don't have permission to kick " + args[0] + }); + return; + } kickee = chan.users[i]; break; }