Changing behavior of the same user on a pad. Kick old sessions instead of refusing new
This commit is contained in:
parent
bf32c18d8d
commit
b692ffec0b
|
@ -520,15 +520,14 @@ function handleClientReady(client, message)
|
||||||
},
|
},
|
||||||
function(callback)
|
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])
|
if(pad2sessions[message.padId])
|
||||||
{
|
{
|
||||||
for(var i in pad2sessions[message.padId])
|
for(var i in pad2sessions[message.padId])
|
||||||
{
|
{
|
||||||
if(sessioninfos[pad2sessions[message.padId][i]].author == author)
|
if(sessioninfos[pad2sessions[message.padId][i]].author == author)
|
||||||
{
|
{
|
||||||
client.send({disconnect:"doublelogin"});
|
socketio.clients[pad2sessions[message.padId][i]].send({disconnect:"doublelogin"});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,39 +90,28 @@ function handshake()
|
||||||
//if we haven't recieved the clientVars yet, then this message should it be
|
//if we haven't recieved the clientVars yet, then this message should it be
|
||||||
if(!receivedClientVars)
|
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)
|
if(obj.disconnect)
|
||||||
{
|
{
|
||||||
socket.disconnect();
|
socket.disconnect();
|
||||||
padconnectionstatus.disconnected("userdup");
|
padconnectionstatus.disconnected("userdup");
|
||||||
return;
|
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
|
else
|
||||||
{
|
{
|
||||||
pad.collabClient.handleMessageFromServer(obj);
|
pad.collabClient.handleMessageFromServer(obj);
|
||||||
|
|
Loading…
Reference in New Issue