add backwards compatibility with older servers

pull/1/head
ansuz 5 years ago
parent cac114bb52
commit 033bd361f9

@ -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

Loading…
Cancel
Save