From 1b2c129380938e89881927cc7815cf6df963e740 Mon Sep 17 00:00:00 2001 From: ansuz Date: Sat, 14 May 2016 13:05:21 +0200 Subject: [PATCH] implement channel removal in amnesiadb --- storage/amnesia.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/storage/amnesia.js b/storage/amnesia.js index bd414b8fb..b7c1702e6 100644 --- a/storage/amnesia.js +++ b/storage/amnesia.js @@ -19,6 +19,10 @@ module.exports.create = function(conf, cb){ var db=[], index=0; + if (conf.removeChannels) { + console.log("Server is set to remove channels %sms after the last remaining client leaves.", conf.channelRemovalTimeout); + } + cb({ message: function(channelName, content, cb){ var val = { @@ -41,5 +45,12 @@ module.exports.create = function(conf, cb){ }); if (cb) { cb(); } }, + removeChannel: function (channelName, cb) { + var err = false; + db = db.filter(function (msg) { + return msg.chan !== channelName; + }); + cb(err); + }, }); };