whoops padid should be in payload..

This commit is contained in:
John McLear 2013-04-02 23:15:16 +01:00
parent 8b1a11d5d8
commit 9e523191ea

View file

@ -151,19 +151,25 @@ exports.handleMessage = function(client, message)
var handleMessageHook = function(callback){ var handleMessageHook = function(callback){
var dropMessage = false; var dropMessage = false;
console.warn("messsssage", message);
// Call handleMessage hook. If a plugin returns null, the message will be dropped. Note that for all messages // Call handleMessage hook. If a plugin returns null, the message will be dropped. Note that for all messages
// handleMessage will be called, even if the client is not authorized // handleMessage will be called, even if the client is not authorized
hooks.aCallAll("handleMessage", { client: client, message: message }, function ( err, messages ) { hooks.aCallAll("handleMessage", { client: client, message: message }, function ( err, messages ) {
console.warn("Wut", message);
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
_.each(messages, function(newMessage){ _.each(messages, function(newMessage){
console.warn("OH NOES!", message);
console.warn("newMessage", newMessage);
if ( newMessage === null ) { if ( newMessage === null ) {
console.warn("FUCK NO!");
dropMessage = true; dropMessage = true;
} }
}); });
// If no plugins explicitly told us to drop the message, its ok to proceed // If no plugins explicitly told us to drop the message, its ok to proceed
if(!dropMessage){ callback() }; if(!dropMessage){
console.warn("proceeding");
callback() };
}); });
} }
@ -265,7 +271,7 @@ exports.handleCustomObjectMessage = function (msg, sessionID, cb) {
if(sessionID){ // If a sessionID is targeted then send directly to this sessionID if(sessionID){ // If a sessionID is targeted then send directly to this sessionID
socketio.sockets.socket(sessionID).json.send(msg); // send a targeted message socketio.sockets.socket(sessionID).json.send(msg); // send a targeted message
}else{ }else{
socketio.sockets.in(msg.data.padId).json.send(msg); // broadcast to all clients on this pad socketio.sockets.in(msg.data.payload.padId).json.send(msg); // broadcast to all clients on this pad
} }
} }
cb(null, {}); cb(null, {});