From 62dba6de7ba6a8616e666ff1182f7656430df1d4 Mon Sep 17 00:00:00 2001 From: ansuz Date: Sat, 14 May 2016 13:27:15 +0200 Subject: [PATCH] add specific complaints for removeChannel's non-existence --- NetfluxWebsocketSrv.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/NetfluxWebsocketSrv.js b/NetfluxWebsocketSrv.js index 3d0d44d7f..8ce1ab442 100644 --- a/NetfluxWebsocketSrv.js +++ b/NetfluxWebsocketSrv.js @@ -65,15 +65,20 @@ dropUser = function (ctx, user) { /* Call removeChannel if it is a function and channel removal is set to true in the config file */ - if (ctx.config.removeChannels && typeof(ctx.store.removeChannel) === 'function') { - ctx.timeouts[chanName] = setTimeout(function () { - ctx.store.removeChannel(chanName, function (err) { - if (err) { console.error("[removeChannelErr]: %s", err); } - else { - console.log("Deleted channel [%s] history from database...", chanName); - } - }); - }, ctx.config.channelRemovalTimeout); + if (ctx.config.removeChannels) { + if (typeof(ctx.store.removeChannel) === 'function') { + ctx.timeouts[chanName] = setTimeout(function () { + ctx.store.removeChannel(chanName, function (err) { + if (err) { console.error("[removeChannelErr]: %s", err); } + else { + console.log("Deleted channel [%s] history from database...", chanName); + } + }); + }, 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 { sendChannelMessage(ctx, chan, [user.id, 'LEAVE', chanName, 'Quit: [ dropUser() ]']);