only update room text if its topic

will fix this in a better way
This commit is contained in:
barisusakli
2014-09-04 23:26:55 -04:00
parent e28d778c0c
commit 190647a074
2 changed files with 8 additions and 8 deletions

View File

@@ -188,7 +188,9 @@ Sockets.init = function(server) {
emitOnlineUserCount(); emitOnlineUserCount();
for(var roomName in io.sockets.manager.roomClients[socket.id]) { for(var roomName in io.sockets.manager.roomClients[socket.id]) {
updateRoomBrowsingText(roomName.slice(1)); if (roomName.indexOf('topic') !== -1) {
updateRoomBrowsingText(roomName.slice(1));
}
} }
}); });

View File

@@ -72,15 +72,13 @@ SocketMeta.rooms.enter = function(socket, data, callback) {
socket.join(data.enter); socket.join(data.enter);
if (data.leave && data.leave !== data.enter) { if (data.leave && data.leave !== data.enter && data.leave.indexOf('topic') !== -1) {
module.parent.exports.updateRoomBrowsingText(data.leave); module.parent.exports.updateRoomBrowsingText(data.leave);
} }
module.parent.exports.updateRoomBrowsingText(data.enter); if (data.enter.indexOf('topic') !== -1) {
module.parent.exports.updateRoomBrowsingText(data.enter);
//if (data.enter !== 'admin') { }
// websockets.in('admin').emit('event:meta.rooms.update', null, websockets.server.sockets.manager.rooms);
//}
}; };
SocketMeta.rooms.getAll = function(socket, data, callback) { SocketMeta.rooms.getAll = function(socket, data, callback) {
@@ -88,7 +86,7 @@ SocketMeta.rooms.getAll = function(socket, data, callback) {
onlineGuestCount: websockets.getOnlineAnonCount(), onlineGuestCount: websockets.getOnlineAnonCount(),
onlineRegisteredCount: websockets.getConnectedClients().length, onlineRegisteredCount: websockets.getConnectedClients().length,
rooms: websockets.server.sockets.manager.rooms rooms: websockets.server.sockets.manager.rooms
} };
callback(null, userData); callback(null, userData);
}; };