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) {
var modal = null;
if (chat.modalExists(data.fromuid)) {

@ -114,7 +114,7 @@ define(['taskbar'], function(taskbar) {
}
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) {
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());
if(msg.length) {
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('');
}
}

@ -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;
Messaging.getMessages(uid, touid, function(err, messages) {
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;
if (touid === uid || uid === 0) {
@ -715,7 +715,7 @@ websockets.init = function(io) {
numSockets = userSockets[touid].length;
for (var x = 0; x < numSockets; ++x) {
userSockets[touid][x].emit('chatMessage', {
userSockets[touid][x].emit('event:chats.receive', {
fromuid: uid,
username: username,
message: finalMessage,
@ -729,7 +729,7 @@ websockets.init = function(io) {
numSockets = userSockets[uid].length;
for (var x = 0; x < numSockets; ++x) {
userSockets[uid][x].emit('chatMessage', {
userSockets[uid][x].emit('event:chats.receive', {
fromuid: touid,
username: username,
message: 'You : ' + msg,

Loading…
Cancel
Save