Fix a few things

This commit is contained in:
calzoneman 2013-12-26 10:17:33 -05:00
parent 423c787ccb
commit 6ac64a6cf3
3 changed files with 17 additions and 14 deletions

View File

@ -25,21 +25,22 @@ module.exports = {
}
}
db.recordAction(ip, name, action, args);
//db.recordAction(ip, name, action, args);
},
clear: function (actions) {
var db = Server.getServer().db;
db.clearActions(actions);
//db.clearActions(actions);
},
clearOne: function (item) {
var db = Server.getServer().db;
db.clearSingleAction(item);
//db.clearSingleAction(item);
},
throttleRegistrations: function (ip, callback) {
var db = Server.getServer().db;
/*
db.recentRegistrationCount(ip, function (err, count) {
if(err) {
callback(err, null);
@ -48,15 +49,16 @@ module.exports = {
callback(null, count > 4);
});
*/
},
listActionTypes: function (callback) {
var db = Server.getServer().db;
db.listActionTypes(callback);
//db.listActionTypes(callback);
},
listActions: function (types, callback) {
var db = Server.getServer().db;
db.listActions(types, callback);
//db.listActions(types, callback);
}
};

View File

@ -136,9 +136,9 @@ var Channel = function(name) {
}
db.channels.load(self, function (err) {
if (err)
if (err && err !== "Channel is not registered")
return;
else if (!err || err === "Channel is not registered")
else
self.dbloaded = true;
self.tryLoadDump();

View File

@ -36,10 +36,11 @@ function createBansTable(name, callback) {
}
function initTables(name, owner, callback) {
if (!valid(chan)) {
if (!valid(name)) {
callback("Invalid channel name", null);
return;
}
createRanksTable(name, function (err) {
if (err) {
callback(err, null);
@ -91,12 +92,12 @@ module.exports = {
return;
}
if (!valid(chan)) {
if (!valid(name)) {
callback("Invalid channel name", null);
return;
}
dbutil.query("SELECT name FROM `channels` WHERE name=?",
db.query("SELECT name FROM `channels` WHERE name=?",
[name],
function (err, rows) {
if (err) {
@ -120,7 +121,7 @@ module.exports = {
return;
}
dbutil.query("SELECT * FROM `channels` WHERE name=?",
db.query("SELECT * FROM `channels` WHERE name=?",
[name],
function (err, rows) {
if (err) {
@ -139,7 +140,7 @@ module.exports = {
return;
}
dbutil.query("SELECT * FROM `channels` WHERE name LIKE ?",
db.query("SELECT * FROM `channels` WHERE name LIKE ?",
["%" + name + "%"],
function (err, rows) {
if (err) {
@ -180,7 +181,7 @@ module.exports = {
return;
}
dbutil.query("INSERT INTO `channels` " +
db.query("INSERT INTO `channels` " +
"(`name`, `owner`, `time`) VALUES (?, ?, ?)",
[name, owner, Date.now()],
function (err, res) {
@ -191,7 +192,7 @@ module.exports = {
initTables(name, owner, function (err, res) {
if (err) {
dbutil.query("DELETE FROM `channels` WHERE name=?", [name]);
db.query("DELETE FROM `channels` WHERE name=?", [name]);
callback(err, null);
return;
}