From b8b6f03fcaeb6fdf617bf92d9464e42085ce4fbe Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Thu, 12 Sep 2013 12:03:58 -0700 Subject: [PATCH] Re-enable archive ids --- clientapp/helpers/xmppEventHandlers.js | 20 +++++++++++--------- clientapp/libraries/stanza.io.js | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) 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({