diff --git a/modules/API/API.js b/modules/API/API.js index 44256ff7b..ac9f7e6b2 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -138,10 +138,10 @@ function setupListeners() { APP.xmpp.addListener(XMPPEvents.MUC_MEMBER_JOINED, function (from) { API.triggerEvent("participantJoined", {jid: from}); }); - APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, function (from, nick, txt, myjid) { + APP.xmpp.addListener(XMPPEvents.MESSAGE_RECEIVED, function (from, nick, txt, myjid, stamp) { if (from != myjid) API.triggerEvent("incomingMessage", - {"from": from, "nick": nick, "message": txt}); + {"from": from, "nick": nick, "message": txt, "stamp": stamp}); }); APP.xmpp.addListener(XMPPEvents.MUC_MEMBER_LEFT, function (jid) { API.triggerEvent("participantLeft", {jid: jid}); diff --git a/modules/UI/UI.js b/modules/UI/UI.js index 0e68d1831..6c3a243ba 100644 --- a/modules/UI/UI.js +++ b/modules/UI/UI.js @@ -408,9 +408,9 @@ function chatSetSubject(text) return Chat.chatSetSubject(text); }; -function updateChatConversation(from, displayName, message) { - return Chat.updateChatConversation(from, displayName, message); -}; +function updateChatConversation(from, displayName, message, myjid, stamp) { + return Chat.updateChatConversation(from, displayName, message, myjid, stamp); +} function onMucJoined(jid, info) { Toolbar.updateRoomUrl(window.location.href); diff --git a/modules/UI/side_pannels/chat/Chat.js b/modules/UI/side_pannels/chat/Chat.js index 5f9fb7e9c..e5965bea7 100644 --- a/modules/UI/side_pannels/chat/Chat.js +++ b/modules/UI/side_pannels/chat/Chat.js @@ -85,8 +85,8 @@ function setVisualNotification(show) { * Returns the current time in the format it is shown to the user * @returns {string} */ -function getCurrentTime() { - var now = new Date(); +function getCurrentTime(stamp) { + var now = (stamp? new Date(stamp): new Date()); var hour = now.getHours(); var minute = now.getMinutes(); var second = now.getSeconds(); @@ -228,7 +228,7 @@ var Chat = (function (my) { /** * Appends the given message to the chat conversation. */ - my.updateChatConversation = function (from, displayName, message) { + my.updateChatConversation = function (from, displayName, message, myjid, stamp) { var divClassName = ''; if (APP.xmpp.myJid() === from) { @@ -256,7 +256,7 @@ var Chat = (function (my) { '
'; diff --git a/modules/xmpp/strophe.emuc.js b/modules/xmpp/strophe.emuc.js index 1a7d68fbf..68a67d1ac 100644 --- a/modules/xmpp/strophe.emuc.js +++ b/modules/xmpp/strophe.emuc.js @@ -389,7 +389,7 @@ module.exports = function(XMPP, eventEmitter) { if (txt) { console.log('chat', nick, txt); eventEmitter.emit(XMPPEvents.MESSAGE_RECEIVED, - from, nick, txt, this.myroomjid); + from, nick, txt, this.myroomjid, $(msg).find('>delay').attr('stamp')); } return true; },