* client.runtime.* renamed to client.session.*

* some work on area names - need to fix login issue & rest shoudl work
This commit is contained in:
Bryan Ashby 2015-09-25 23:10:18 -06:00
parent 1082b6e39c
commit df477667b0
9 changed files with 14 additions and 10 deletions

View File

@ -186,8 +186,8 @@ function startListening() {
// Start tracking the client. We'll assign it an ID which is
// just the index in our connections array.
//
if(_.isUndefined(client.runtime)) {
client.runtime = {};
if(_.isUndefined(client.session)) {
client.session = {};
}
clientConns.addNewClient(client);
@ -205,12 +205,12 @@ function startListening() {
});
client.on('error', function onClientError(err) {
logger.log.info({ clientId : client.runtime.id }, 'Connection error: %s' % err.message);
logger.log.info({ clientId : client.session.id }, 'Connection error: %s' % err.message);
});
client.on('close', function onClientClose(hadError) {
var l = hadError ? logger.log.info : logger.log.debug;
l( { clientId : client.runtime.id }, 'Connection closed');
l( { clientId : client.session.id }, 'Connection closed');
clientConns.removeClient(client);
});

View File

@ -106,7 +106,7 @@ function Client(input, output) {
Object.defineProperty(this, 'node', {
get : function() {
return self.runtime.id + 1;
return self.session.id + 1;
}
});

View File

@ -10,7 +10,7 @@ var clientConnections = [];
exports.clientConnections = clientConnections;
function addNewClient(client) {
var id = client.runtime.id = clientConnections.push(client) - 1;
var id = client.session.id = clientConnections.push(client) - 1;
// Create a client specific logger
client.log = logger.log.child( { clientId : id } );
@ -37,7 +37,7 @@ function removeClient(client) {
logger.log.info(
{
connectionCount : clientConnections.length,
clientId : client.runtime.id
clientId : client.session.id
},
'Client disconnected'
);

View File

@ -104,7 +104,7 @@ function FullScreenEditorModule(options) {
this.editorMode = config.editorMode;
if(_.isObject(options.extraArgs)) {
console.log(options.extraArgs)
//console.log(options.extraArgs)
this.messageAreaName = options.extraArgs.messageAreaName || Message.WellKnownAreaNames.Private;
console.log(this.messageAreaName)
this.messageIndex = options.extraArgs.messageIndex || 0;

View File

@ -24,6 +24,7 @@ function getMessageAreaByName(areaName) {
areaName = areaName.toLowerCase();
var availAreas = getAvailableMessageAreas();
console.log(availAreas)
var index = _.findIndex(availAreas, function pred(an) {
return an.name == areaName;
});

View File

@ -41,7 +41,7 @@ function login(callingMenu, formData, extraArgs) {
if(existingClientConnection) {
client.log.info( {
existingClientId : existingClientConnection.runtime.id,
existingClientId : existingClientConnection.session.id,
username : user.username,
userId : user.userId },
'Already logged in'

View File

@ -246,6 +246,9 @@
art: NUAFDBK
options: { pause: true }
next: newUserFeedbackToSysOp
extraArgs: {
messageAreaName: private_mail
}
}
newUserFeedbackToSysOp: {

View File

@ -61,7 +61,7 @@ require('util').inherits(AreaPostFSEModule, FullScreenEditorModule);
AreaPostFSEModule.prototype.enter = function(client) {
if(_.isString(client.user.properties.message_area_name)) {
if(_.isString(client.user.properties.message_area_name) && !_.isString(this.messageAreaName)) {
this.messageAreaName = client.user.properties.message_area_name;
}

Binary file not shown.