From 3f2095b14e9bcf1619c5a7fe1a3042d2d72f0a9f Mon Sep 17 00:00:00 2001 From: calzoneman Date: Wed, 10 Apr 2013 19:51:30 -0500 Subject: [PATCH] Fix banning --- channel.js | 3 ++- chatcommand.js | 8 +++++++- database.js | 4 ++-- server.js | 3 +-- www/assets/js/functions.js | 1 + 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/channel.js b/channel.js index 6c5a2bec..1ed15fca 100644 --- a/channel.js +++ b/channel.js @@ -202,7 +202,7 @@ Channel.prototype.banIP = function(actor, receiver) { this.ipbans[receiver.ip] = [receiver.name, actor.name]; receiver.socket.disconnect(); this.broadcastBanlist(); - this.logger.log(bannee.ip + " (" + bannee.name + ") was banned by " + banner.name); + this.logger.log(receiver.ip + " (" + receiver.name + ") was banned by " + actor.name); if(!this.registered) return false; @@ -220,6 +220,7 @@ Channel.prototype.unbanIP = function(actor, ip) { if(!this.registered) return false; + this.broadcastBanlist(); // Update database ban table return Database.removeChannelBan(this.name, ip); } diff --git a/chatcommand.js b/chatcommand.js index 01843956..de445c78 100644 --- a/chatcommand.js +++ b/chatcommand.js @@ -52,6 +52,9 @@ function handleKick(chan, user, args) { } if(kickee) { chan.logger.log("*** " + user.name + " kicked " + args[0]); + if(kickee.socket.disconnected) { + chan.userLeave(kickee); + } kickee.socket.disconnect(); } } @@ -68,6 +71,9 @@ function handleBan(chan, user, args) { } if(kickee && kickee.rank < user.rank) { chan.logger.log("*** " + user.name + " banned " + args[0]); + if(kickee.socket.disconnected) { + chan.userLeave(kickee); + } chan.banIP(user, kickee); } } @@ -76,7 +82,7 @@ function handleBan(chan, user, args) { function handleUnban(chan, user, args) { if(Rank.hasPermission(user, "ipban") && args.length > 0) { chan.logger.log("*** " + user.name + " unbanned " + args[0]); - chan.unbanIP(args[0]); + chan.unbanIP(user, args[0]); } } diff --git a/database.js b/database.js index f8a7ddd1..7929d12b 100644 --- a/database.js +++ b/database.js @@ -243,8 +243,8 @@ exports.addChannelBan = function(channame, actor, receiver) { } var query = "INSERT INTO chan_{1}_bans (`ip`, `name`, `banner`) VALUES ('{2}', '{3}', '{4}')" .replace("{1}", channame) - .replace("{2}", reciever.ip) - .replace("{3}", reciever.name) + .replace("{2}", receiver.ip) + .replace("{3}", receiver.name) .replace("{4}", actor.name); results = db.querySync(query); db.closeSync(); diff --git a/server.js b/server.js index 291ea55b..b8351e2c 100644 --- a/server.js +++ b/server.js @@ -9,7 +9,7 @@ The above copyright notice and this permission notice shall be included in all c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -const VERSION = "1.1.3"; +const VERSION = "1.1.4"; var fs = require("fs"); var Logger = require("./logger.js"); @@ -49,7 +49,6 @@ exports.io.sockets.on("connection", function(socket) { }); - process.on("uncaughtException", function(err) { Logger.errlog.log("[SEVERE] Uncaught Exception: " + err); }); diff --git a/www/assets/js/functions.js b/www/assets/js/functions.js index 288f94c2..992c5809 100644 --- a/www/assets/js/functions.js +++ b/www/assets/js/functions.js @@ -38,6 +38,7 @@ function addUser(name, rank, leader) { // Format a userlist entry based on a person"s rank function fmtUserlistItem(div, rank, leader) { var name = div.children[1]; + $(name).removeClass(); if(rank >= Rank.Siteadmin) $(name).attr("class", "userlist_siteadmin"); else if(rank >= Rank.Owner)