mirror of https://github.com/calzoneman/sync.git
Fix banning guest names, add ban message to chat
This commit is contained in:
parent
6f0e1e96a1
commit
1294a7bd50
21
channel.js
21
channel.js
|
@ -556,8 +556,17 @@ Channel.prototype.tryNameBan = function(actor, name) {
|
|||
}
|
||||
}
|
||||
self.logger.log("*** " + actor.name + " namebanned " + name);
|
||||
var notice = {
|
||||
username: "[server]",
|
||||
msg: actor.name + " banned " + name,
|
||||
msgclass: "server-whisper",
|
||||
time: Date.now()
|
||||
};
|
||||
self.users.forEach(function(u) {
|
||||
if(self.hasPermission(u, "ban")) {
|
||||
self.sendBanlist(u);
|
||||
u.socket.emit("chatMsg", notice);
|
||||
}
|
||||
});
|
||||
|
||||
if(!self.registered) {
|
||||
|
@ -614,7 +623,7 @@ Channel.prototype.tryIPBan = function(actor, name, range) {
|
|||
self.getIPRank(ip, function (err, rank) {
|
||||
if(err) {
|
||||
actor.socket.emit("errorMsg", {
|
||||
msg: "Internal error"
|
||||
msg: "Internal error: " + err
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -644,8 +653,18 @@ Channel.prototype.tryIPBan = function(actor, name, range) {
|
|||
self.server.db.addChannelBan(self.name, ip, name,
|
||||
actor.name,
|
||||
function (err, res) {
|
||||
var notice = {
|
||||
username: "[server]",
|
||||
msg: actor.name + " banned " + $util.maskIP(ip) +
|
||||
" (" + name + ")",
|
||||
msgclass: "server-whisper",
|
||||
time: Date.now()
|
||||
};
|
||||
self.users.forEach(function(u) {
|
||||
if(self.hasPermission(u, "ban")) {
|
||||
u.socket.emit("chatMsg", notice);
|
||||
self.sendBanlist(u);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -925,7 +925,7 @@ Database.prototype.getGlobalRank = function (name, callback) {
|
|||
}
|
||||
|
||||
if(res.length == 0) {
|
||||
callback("User does not exist", null);
|
||||
callback(null, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -956,7 +956,7 @@ Database.prototype.listGlobalRanks = function (names, callback) {
|
|||
}
|
||||
|
||||
if(res.length == 0) {
|
||||
callback("User does not exist", null);
|
||||
callback(null, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"author": "Calvin Montgomery",
|
||||
"name": "CyTube",
|
||||
"description": "Online media synchronizer and chat",
|
||||
"version": "2.4.0",
|
||||
"version": "2.4.1",
|
||||
"repository": {
|
||||
"url": "http://github.com/calzoneman/sync"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue