meta fixes

v1.18.x
Baris Soner Usakli 11 years ago
parent c0712583f2
commit a34775a6c2

@ -30,12 +30,14 @@ SocketMeta.reconnected = function(socket) {
}; };
SocketMeta.buildTitle = function(socket, text, callback) { SocketMeta.buildTitle = function(socket, text, callback) {
meta.title.build(text, function(err, title) { meta.title.build(text, callback);
callback(err, title);
});
}; };
SocketMeta.updateHeader = function(socket, data, callback) { SocketMeta.updateHeader = function(socket, data, callback) {
if(!data) {
return callback(new Error('invalid data'));
}
if (socket.uid) { if (socket.uid) {
user.getUserFields(socket.uid, data.fields, function(err, fields) { user.getUserFields(socket.uid, data.fields, function(err, fields) {
if(err) { if(err) {
@ -46,7 +48,7 @@ SocketMeta.updateHeader = function(socket, data, callback) {
fields.uid = socket.uid; fields.uid = socket.uid;
callback(null, fields); callback(null, fields);
} else { } else {
callback([]); callback(null, []);
} }
}); });
} else { } else {
@ -73,6 +75,10 @@ SocketMeta.getUsageStats = function(socket, data, callback) {
SocketMeta.rooms = {}; SocketMeta.rooms = {};
SocketMeta.rooms.enter = function(socket, data) { SocketMeta.rooms.enter = function(socket, data) {
if(!data) {
return callback(new Error('invalid data'));
}
if (data.leave !== null) { if (data.leave !== null) {
socket.leave(data.leave); socket.leave(data.leave);
} }

Loading…
Cancel
Save