diff --git a/clientapp/helpers/xmppEventHandlers.js b/clientapp/helpers/xmppEventHandlers.js index 17bfa3b..d220653 100644 --- a/clientapp/helpers/xmppEventHandlers.js +++ b/clientapp/helpers/xmppEventHandlers.js @@ -205,17 +205,19 @@ module.exports = function (client, app) { var contact = me.getContact(msg.from, msg.to); if (contact && !msg.replace) { var message = new Message(); - message.cid = msg.id; + if (msg.id) { + message.cid = msg.id; + } message.set(msg); - //if (msg.archived) { - // msg.archived.forEach(function (archived) { - // if (me.isMe(archived.by)) { - // message.id = archived.id; - // message.cid = msg.id; - // } - // }); - //} + if (msg.archived) { + msg.archived.forEach(function (archived) { + if (me.isMe(archived.by)) { + message.id = archived.id; + message.cid = msg.id || archived.id; + } + }); + } if (!contact.activeContact && msg.from.bare === contact.jid) { contact.unreadCount++; diff --git a/clientapp/libraries/stanza.io.js b/clientapp/libraries/stanza.io.js index d164f54..2652469 100644 --- a/clientapp/libraries/stanza.io.js +++ b/clientapp/libraries/stanza.io.js @@ -3072,7 +3072,7 @@ Prefs.prototype = { Message.prototype.__defineGetter__('archived', function () { - var archives = stanza.find(this.xml, this.NS, 'archived'); + var archives = stanza.find(this.xml, 'urn:xmpp:mam:tmp', 'archived'); var results = []; archives.forEach(function (archive) { results.push({