disabled browsing users and global rooms syncing

v1.18.x
barisusakli 9 years ago
parent 45be95af85
commit be86c74c91

@ -263,6 +263,14 @@ Sockets.isUsersOnline = function(uids, callback) {
}; };
Sockets.getUsersInRoom = function (uid, roomName, start, stop, callback) { Sockets.getUsersInRoom = function (uid, roomName, start, stop, callback) {
callback(null, {
users: [],
room: roomName,
total: 0,
hidden: 0
});
return;
if (!roomName) { if (!roomName) {
return; return;
} }

@ -52,14 +52,14 @@ SocketMeta.rooms.enter = function(socket, data, callback) {
if (data.enter) { if (data.enter) {
rooms.enter(socket, data.enter); rooms.enter(socket, data.enter);
socket.currentRoom = data.enter; socket.currentRoom = data.enter;
if (data.enter.indexOf('topic') !== -1) { // if (data.enter.indexOf('topic') !== -1) {
data.uid = socket.uid; // data.uid = socket.uid;
data.picture = validator.escape(data.picture); // data.picture = validator.escape(data.picture);
data.username = validator.escape(data.username); // data.username = validator.escape(data.username);
data.userslug = validator.escape(data.userslug); // data.userslug = validator.escape(data.userslug);
websockets.in(data.enter).emit('event:user_enter', data); // websockets.in(data.enter).emit('event:user_enter', data);
} // }
} }
callback(); callback();
}; };
@ -75,9 +75,9 @@ SocketMeta.rooms.leaveCurrent = function(socket, data, callback) {
function leaveCurrentRoom(socket) { function leaveCurrentRoom(socket) {
if (socket.currentRoom) { if (socket.currentRoom) {
rooms.leave(socket, socket.currentRoom); rooms.leave(socket, socket.currentRoom);
if (socket.currentRoom.indexOf('topic') !== -1) { // if (socket.currentRoom.indexOf('topic') !== -1) {
websockets.in(socket.currentRoom).emit('event:user_leave', socket.uid); // websockets.in(socket.currentRoom).emit('event:user_leave', socket.uid);
} // }
socket.currentRoom = ''; socket.currentRoom = '';
} }
} }

@ -19,12 +19,12 @@ var roomClients = {};
rooms.enter = function(socket, room) { rooms.enter = function(socket, room) {
socket.join(room); socket.join(room);
pubsub.publish('socket:join', {id: socket.id, room: room}); //pubsub.publish('socket:join', {id: socket.id, room: room});
}; };
rooms.leave = function(socket, room) { rooms.leave = function(socket, room) {
socket.leave(room); socket.leave(room);
pubsub.publish('socket:leave', {id: socket.id, room: room}); //pubsub.publish('socket:leave', {id: socket.id, room: room});
}; };
rooms.leaveAll = function(socket, roomsToLeave) { rooms.leaveAll = function(socket, roomsToLeave) {

Loading…
Cancel
Save