Fix ip bans for like the 4th time

This commit is contained in:
calzoneman 2013-04-27 23:10:48 -05:00
parent fb702934f1
commit 535b80153d
5 changed files with 10 additions and 4 deletions

View File

@ -218,7 +218,12 @@ Channel.prototype.banIP = function(actor, receiver) {
return false;
this.ipbans[receiver.ip] = [receiver.name, actor.name];
receiver.socket.disconnect(true);
try {
receiver.socket.disconnect(true);
}
catch(e) {
// Socket already disconnected
}
this.broadcastBanlist();
this.logger.log(receiver.ip + " (" + receiver.name + ") was banned by " + actor.name);

View File

@ -84,6 +84,7 @@ function handleBan(chan, user, args) {
args[0] = "";
var reason = args.join(" ");
chan.kick(kickee, "(banned) " + reason);
chan.banIP(user, kickee);
}
}
}

View File

@ -284,7 +284,7 @@ exports.removeChannelBan = function(channame, ip) {
return false;
}
var query = "DELETE FROM chan_{1}_bans WHERE `ip` = '{2}'"
.replace("{1}", sqlEscale(channame))
.replace("{1}", sqlEscape(channame))
.replace("{2}", sqlEscape(ip));
results = db.querySync(query);
db.closeSync();

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery",
"name": "CyTube",
"description": "Online media synchronizer and chat",
"version": "1.3.4",
"version": "1.3.5",
"repository": {
"url": "http://github.com/calzoneman/sync"
},

View File

@ -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.3.4";
const VERSION = "1.3.5";
var fs = require("fs");
var Logger = require("./logger.js");