v1.18.x
Baris Soner Usakli 11 years ago
parent 36745608bf
commit 34fc326a37

@ -208,7 +208,7 @@
}); });
}); });
socket.on('chatMessage', function(data) { socket.on('event:chats.receive', function(data) {
require(['chat'], function(chat) { require(['chat'], function(chat) {
var modal = null; var modal = null;
if (chat.modalExists(data.fromuid)) { if (chat.modalExists(data.fromuid)) {

@ -114,7 +114,7 @@ define(['taskbar'], function(taskbar) {
} }
function getChatMessages(chatModal, callback) { function getChatMessages(chatModal, callback) {
socket.emit('getChatMessages', {touid:chatModal.touid}, function(messages) { socket.emit('api:chats.get', {touid:chatModal.touid}, function(messages) {
for(var i = 0; i<messages.length; ++i) { for(var i = 0; i<messages.length; ++i) {
module.appendChatMessage(chatModal, messages[i].content, messages[i].timestamp); module.appendChatMessage(chatModal, messages[i].content, messages[i].timestamp);
} }
@ -141,7 +141,7 @@ define(['taskbar'], function(taskbar) {
var msg = app.strip_tags(chatModal.find('#chat-message-input').val()); var msg = app.strip_tags(chatModal.find('#chat-message-input').val());
if(msg.length) { if(msg.length) {
msg = msg +'\n'; msg = msg +'\n';
socket.emit('sendChatMessage', { touid:chatModal.touid, message:msg}); socket.emit('api:chats.send', { touid:chatModal.touid, message:msg});
chatModal.find('#chat-message-input').val(''); chatModal.find('#chat-message-input').val('');
} }
} }

@ -677,7 +677,7 @@ websockets.init = function(io) {
}); });
}); });
socket.on('getChatMessages', function(data, callback) { socket.on('api:chats.get', function(data, callback) {
var touid = data.touid; var touid = data.touid;
Messaging.getMessages(uid, touid, function(err, messages) { Messaging.getMessages(uid, touid, function(err, messages) {
if (err) if (err)
@ -687,7 +687,7 @@ websockets.init = function(io) {
}); });
}); });
socket.on('sendChatMessage', function(data) { socket.on('api:chats.send', function(data) {
var touid = data.touid; var touid = data.touid;
if (touid === uid || uid === 0) { if (touid === uid || uid === 0) {
@ -715,7 +715,7 @@ websockets.init = function(io) {
numSockets = userSockets[touid].length; numSockets = userSockets[touid].length;
for (var x = 0; x < numSockets; ++x) { for (var x = 0; x < numSockets; ++x) {
userSockets[touid][x].emit('chatMessage', { userSockets[touid][x].emit('event:chats.receive', {
fromuid: uid, fromuid: uid,
username: username, username: username,
message: finalMessage, message: finalMessage,
@ -729,7 +729,7 @@ websockets.init = function(io) {
numSockets = userSockets[uid].length; numSockets = userSockets[uid].length;
for (var x = 0; x < numSockets; ++x) { for (var x = 0; x < numSockets; ++x) {
userSockets[uid][x].emit('chatMessage', { userSockets[uid][x].emit('event:chats.receive', {
fromuid: touid, fromuid: touid,
username: username, username: username,
message: 'You : ' + msg, message: 'You : ' + msg,

Loading…
Cancel
Save