This commit is contained in:
barisusakli
2014-04-15 12:48:28 -04:00
parent 549f87132d
commit 04488a9a14
4 changed files with 70 additions and 11 deletions

View File

@@ -208,6 +208,23 @@ function sendChatNotification(fromuid, touid, username) {
}
}
SocketModules.chats.userStartTyping = function(socket, data, callback) {
sendTypingNotification('event:chats.userStartTyping', socket, data, callback);
};
SocketModules.chats.userStopTyping = function(socket, data, callback) {
sendTypingNotification('event:chats.userStopTyping', socket, data, callback);
};
function sendTypingNotification(event, socket, data, callback) {
if (!socket.uid || !data) {
return;
}
server.getUserSockets(data.touid).forEach(function(socket) {
socket.emit(event, data.fromUid);
});
}
SocketModules.chats.list = function(socket, data, callback) {
Messaging.getRecentChats(socket.uid, callback);
};