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) { channelOpen: function (Server, channelName, userId, wait) {
Env.channel_cache[channelName] = Env.channel_cache[channelName] || {}; Env.channel_cache[channelName] = Env.channel_cache[channelName] || {};
var next = wait(); var sendHKJoinMessage = function () {
var cb = function (err, info) {
next(err, info, function () {
Server.send(userId, [ Server.send(userId, [
0, 0,
Env.id, Env.id,
'JOIN', 'JOIN',
channelName 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, sendHKJoinMessage);
}; };
// only conventional channels can be restricted // only conventional channels can be restricted

Loading…
Cancel
Save