mirror of https://github.com/calzoneman/sync.git
Fix banning
This commit is contained in:
parent
179460c5b5
commit
3f2095b14e
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue