|
|
|
@ -976,25 +976,24 @@ module.exports.create = function (cfg) {
|
|
|
|
|
command(ctx, seq, user, parsed);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// XXX every one of these values is exported because
|
|
|
|
|
// netfluxWebsocketServer needs them to do some magic historyKeeper things
|
|
|
|
|
// we could have netflux emit events and let historyKeeper handle them instead
|
|
|
|
|
return {
|
|
|
|
|
id: HISTORY_KEEPER_ID,
|
|
|
|
|
|
|
|
|
|
// XXX dropChannel allows netflux to clear historyKeeper's cache
|
|
|
|
|
// maybe it should emit a 'channel_dropped' event instead
|
|
|
|
|
// and let historyKeeper decide what to do
|
|
|
|
|
dropChannel: dropChannel,
|
|
|
|
|
|
|
|
|
|
// XXX we don't need to export checkExpired if netflux allows it to be HK's responsibility
|
|
|
|
|
checkExpired: checkExpired,
|
|
|
|
|
|
|
|
|
|
// XXX again, if netflux emitted events then historyKeeper could handle them itself
|
|
|
|
|
// and netflux wouldn't need to have historyKeeper-specific code
|
|
|
|
|
onDirectMessage: onDirectMessage,
|
|
|
|
|
|
|
|
|
|
// XXX same
|
|
|
|
|
onChannelMessage: onChannelMessage,
|
|
|
|
|
channelMessage: function (ctx, channel, msgStruct) {
|
|
|
|
|
onChannelMessage(ctx, channel, msgStruct);
|
|
|
|
|
},
|
|
|
|
|
channelClose: function (channelName) {
|
|
|
|
|
dropChannel(channelName);
|
|
|
|
|
},
|
|
|
|
|
channelOpen: function (ctx, channelName, user) {
|
|
|
|
|
ctx.sendMsg(ctx, user, [
|
|
|
|
|
0,
|
|
|
|
|
HISTORY_KEEPER_ID, // ctx.historyKeeper.id
|
|
|
|
|
'JOIN',
|
|
|
|
|
channelName
|
|
|
|
|
]);
|
|
|
|
|
},
|
|
|
|
|
directMessage: function (ctx, seq, user, json) {
|
|
|
|
|
onDirectMessage(ctx, seq, user, json);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|