added deletePad API function

This commit is contained in:
Peter 'Pita' Martischka 2011-08-16 20:02:30 +01:00
parent 783c192726
commit d2c502e2be
9 changed files with 134 additions and 7 deletions

View file

@ -73,6 +73,23 @@ exports.handleConnect = function(client)
sessioninfos[client.id]={};
}
/**
* Kicks all sessions from a pad
* @param client the new client
*/
exports.kickSessionsFromPad = function(padID)
{
//skip if there is nobody on this pad
if(!pad2sessions[padID])
return;
//disconnect everyone from this pad
for(var i in pad2sessions[padID])
{
socketio.sockets.sockets[pad2sessions[padID][i]].json.send({disconnect:"deleted"});
}
}
/**
* Handles the disconnection of a user
* @param client the client that leaves
@ -687,7 +704,7 @@ function handleClientReady(client, message)
{
if(sessioninfos[pad2sessions[message.padId][i]].author == author)
{
socketio.sockets.sockets[pad2sessions[message.padId][i]].json.send({disconnect:"doublelogin"});
socketio.sockets.sockets[pad2sessions[message.padId][i]].json.send({disconnect:"userdup"});
}
}
}