mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 02:55:58 +01:00 
			
		
		
		
	fixed #3359
This commit is contained in:
		| @@ -4,7 +4,10 @@ var	meta = require('../meta'), | ||||
| 	Messaging = require('../messaging'), | ||||
| 	utils = require('../../public/src/utils'), | ||||
|  | ||||
| 	async = require('async'), | ||||
|  | ||||
| 	server = require('./'), | ||||
| 	rooms = require('./rooms'), | ||||
|  | ||||
| 	SocketModules = { | ||||
| 		chats: {}, | ||||
| @@ -94,6 +97,37 @@ 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) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user