no rooms.enter for anons check tid on topic enter

v1.18.x
barisusakli 10 years ago
parent 0fba1e37a7
commit cbedc762fd

@ -63,20 +63,23 @@ SocketMeta.getUsageStats = function(socket, data, callback) {
/* Rooms */
SocketMeta.rooms.enter = function(socket, data, callback) {
if (!socket.uid) {
return;
}
if (!data) {
return callback(new Error('[[error:invalid-data]]'));
}
if (data.leave) {
socket.leave(data.leave);
if (socket.uid && data.leave.indexOf('topic') !== -1) {
if (data.leave.indexOf('topic') !== -1) {
websockets.in(data.leave).emit('event:user_leave', socket.uid);
}
}
if (data.enter) {
socket.join(data.enter);
if (socket.uid && data.enter.indexOf('topic') !== -1) {
if (data.enter.indexOf('topic') !== -1) {
data.uid = socket.uid;
websockets.in(data.enter).emit('event:user_enter', data);
}

@ -65,7 +65,7 @@ SocketTopics.post = function(socket, data, callback) {
};
SocketTopics.enter = function(socket, tid, callback) {
if (!tid || !socket.uid) {
if (!parseInt(tid, 10) || !socket.uid) {
return;
}

Loading…
Cancel
Save