Fix setconfig, showconfig and pushconfig from being confused by false values [#331]

This commit is contained in:
reality 2013-04-22 14:46:30 +00:00
parent 5eba864f22
commit f905c58877
2 changed files with 4 additions and 5 deletions

View File

@ -12,7 +12,6 @@ var admin = function(dbot) {
if(configKey) {
this.db.read('config', configKey, function(err, cRecord) {
if(cRecord) {
console.log('record found');
callback(cRecord.value)
} else {
var configPath = dbot.config;
@ -22,7 +21,7 @@ var admin = function(dbot) {
if(_.has(configPath, configKey[i])) {
configPath = configPath[configKey[i]];
} else {
callback(false);
callback(null);
break;
}
}

View File

@ -156,7 +156,7 @@ var commands = function(dbot) {
if(!_.include(noChangeConfig, configPath)) {
this.internalAPI.getCurrentConfig(configPath, function(config) {
if(config) {
if(config !== null) {
// Convert to boolean type if config item boolean
if(_.isBoolean(config)) {
newOption = (newOption == "true");
@ -185,7 +185,7 @@ var commands = function(dbot) {
if(!_.include(noChangeConfig, configPath)) {
this.internalAPI.getCurrentConfig(configPath, function(config) {
if(config) {
if(config !== null) {
if(_.isArray(config)) {
event.reply(configPath + ": " + config + " << " + newOption);
config.push(newOption);
@ -211,7 +211,7 @@ var commands = function(dbot) {
var configPath = event.params[1];
if(configPath) {
this.internalAPI.getCurrentConfig(configPath, function(config) {
if(config) {
if(config !== null) {
if(_.isArray(config)) {
event.reply('Config keys in ' + configPath + ': ' + config);
} else if(_.isObject(config)) {