add specific complaints for removeChannel's non-existence

pull/1/head
ansuz 9 years ago
parent 2d3ed84f5d
commit 62dba6de7b

@ -65,15 +65,20 @@ dropUser = function (ctx, user) {
/* Call removeChannel if it is a function and channel removal is /* Call removeChannel if it is a function and channel removal is
set to true in the config file */ set to true in the config file */
if (ctx.config.removeChannels && typeof(ctx.store.removeChannel) === 'function') { if (ctx.config.removeChannels) {
ctx.timeouts[chanName] = setTimeout(function () { if (typeof(ctx.store.removeChannel) === 'function') {
ctx.store.removeChannel(chanName, function (err) { ctx.timeouts[chanName] = setTimeout(function () {
if (err) { console.error("[removeChannelErr]: %s", err); } ctx.store.removeChannel(chanName, function (err) {
else { if (err) { console.error("[removeChannelErr]: %s", err); }
console.log("Deleted channel [%s] history from database...", chanName); else {
} console.log("Deleted channel [%s] history from database...", chanName);
}); }
}, ctx.config.channelRemovalTimeout); });
}, ctx.config.channelRemovalTimeout);
} else {
console.error("You have configured your server to remove empty channels, " +
"however, the database adaptor you are using has not implemented this behaviour.");
}
} }
} else { } else {
sendChannelMessage(ctx, chan, [user.id, 'LEAVE', chanName, 'Quit: [ dropUser() ]']); sendChannelMessage(ctx, chan, [user.id, 'LEAVE', chanName, 'Quit: [ dropUser() ]']);

Loading…
Cancel
Save