diff --git a/node/MessageHandler.js b/node/MessageHandler.js index 21acb406..ecf11c95 100644 --- a/node/MessageHandler.js +++ b/node/MessageHandler.js @@ -520,15 +520,14 @@ function handleClientReady(client, message) }, function(callback) { - //Check if this author is already on the pad, if yes, kick him! + //Check if this author is already on the pad, if yes, kick the other sessions! if(pad2sessions[message.padId]) { for(var i in pad2sessions[message.padId]) { if(sessioninfos[pad2sessions[message.padId][i]].author == author) { - client.send({disconnect:"doublelogin"}); - return; + socketio.clients[pad2sessions[message.padId][i]].send({disconnect:"doublelogin"}); } } } diff --git a/static/js/pad2.js b/static/js/pad2.js index 93fcfef1..fffb1170 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -90,39 +90,28 @@ function handshake() //if we haven't recieved the clientVars yet, then this message should it be if(!receivedClientVars) { - //We get a disconnect message + if(window.console) + console.log(obj); + + receivedClientVars=true; + + clientVars = obj; + clientVars.userAgent=navigator.userAgent; + clientVars.collab_client_vars.clientAgent=navigator.userAgent; + + pad.init(); + + initalized=true; + } + //This handles every Message after the clientVars + else + { if(obj.disconnect) { socket.disconnect(); padconnectionstatus.disconnected("userdup"); return; } - //yeah, the clientVars are here :). So we can start initalizing the Pad - else - { - if(window.console) - console.log(obj); - - receivedClientVars=true; - - clientVars = obj; - clientVars.userAgent=navigator.userAgent; - clientVars.collab_client_vars.clientAgent=navigator.userAgent; - - pad.init(); - - initalized=true; - } - } - //This handles every Message after the clientVars - else - { - //We can't handle the message before we initalized the pad, so let this message bounce back in 100ms - if(!initalized) - { - setTimeOut(this(obj), 100); - } - //We're initalized, so give this message to the collabClient else { pad.collabClient.handleMessageFromServer(obj);