removed rooms.js removed browsing users, removed chat syncing across sockets

use lastonline for online detection
This commit is contained in:
barisusakli
2015-11-05 12:34:39 -05:00
parent 1ecf27417a
commit 46c2563164
16 changed files with 76 additions and 421 deletions

View File

@@ -7,7 +7,6 @@ var meta = require('../meta'),
async = require('async'),
server = require('./'),
rooms = require('./rooms'),
SocketModules = {
chats: {},
@@ -105,37 +104,6 @@ SocketModules.chats.getRecentChats = function(socket, data, callback) {
Messaging.getRecentChats(socket.uid, start, stop, callback);
};
SocketModules.chats.sync = function(socket, data, callback) {
var chats = [],
uids = [],
socketIds = rooms.clients('uid_' + socket.uid);
rooms.broadcast(socket, 'uid_' + socket.uid, 'query:chats.sync', {}, function(err, sessionData) {
sessionData.forEach(function(data) {
data.forEach(function(chat) {
if (uids.indexOf(chat.uid) === -1) {
chats.push(chat);
uids.push(chat.uid);
}
});
});
callback(err, chats);
});
};
SocketModules.chats.open = function(socket, data, callback) {
rooms.broadcast(socket, 'uid_' + socket.uid, 'event:chats.open', data);
};
SocketModules.chats.close = function(socket, data, callback) {
rooms.broadcast(socket, 'uid_' + socket.uid, 'event:chats.close', data);
};
SocketModules.chats.toggleNew = function(socket, data, callback) {
rooms.broadcast(socket, 'uid_' + socket.uid, 'event:chats.toggleNew', data);
};
/* Sounds */
SocketModules.sounds.getSounds = function(socket, data, callback) {