diff --git a/lib/historyKeeper.js b/lib/historyKeeper.js index 12c9762e5..7cf6dad00 100644 --- a/lib/historyKeeper.js +++ b/lib/historyKeeper.js @@ -116,16 +116,22 @@ module.exports.create = function (config, cb) { channelOpen: function (Server, channelName, userId, wait) { Env.channel_cache[channelName] = Env.channel_cache[channelName] || {}; + var sendHKJoinMessage = function () { + Server.send(userId, [ + 0, + Env.id, + 'JOIN', + channelName + ]); + }; + + // a little backwards compatibility in case you don't have the latest server + // allow lists won't work unless you update, though + if (typeof(wait) !== 'function') { return void sendHKJoinMessage(); } + var next = wait(); var cb = function (err, info) { - next(err, info, function () { - Server.send(userId, [ - 0, - Env.id, - 'JOIN', - channelName - ]); - }); + next(err, info, sendHKJoinMessage); }; // only conventional channels can be restricted