pull/35/head
Peter 'Pita' Martischka 2011-05-23 20:11:57 +01:00
parent 6a94c5de94
commit 254762eb8a
1 changed files with 39 additions and 35 deletions

View File

@ -78,6 +78,9 @@ exports.handleDisconnect = function(client)
//save the padname of this session
var sessionPad=session2pad[client.sessionId];
//if this connection was already etablished with a handshake, send a disconnect message to the others
if(sessioninfos[client.sessionId].author)
{
var author = sessioninfos[client.sessionId].author;
//get the author color out of the db
@ -99,6 +102,14 @@ exports.handleDisconnect = function(client)
}
};
//Go trough all user that are still on the pad, and send them the USER_LEAVE message
for(i in pad2sessions[sessionPad])
{
socketio.clients[pad2sessions[sessionPad][i]].send(messageToTheOtherUsers);
}
});
}
//Go trough all sessions of this pad, search and destroy the entry of this client
for(i in pad2sessions[sessionPad])
{
@ -109,16 +120,9 @@ exports.handleDisconnect = function(client)
}
}
//Go trough all user that are still on the pad, and send them the USER_LEAVE message
for(i in pad2sessions[sessionPad])
{
socketio.clients[pad2sessions[sessionPad][i]].send(messageToTheOtherUsers);
}
//Delete the session2pad and sessioninfos entrys of this session
delete session2pad[client.sessionId];
delete sessioninfos[client.sessionId];
});
}
/**