From d201c65f7c291ff27cae20004b922e463376ab65 Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 16 Dec 2015 14:15:43 -0800 Subject: [PATCH] More verbose logging in message receiver // FREEBIE --- js/libtextsecure.js | 8 ++++++-- libtextsecure/message_receiver.js | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 1580c63a..097e37da 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -36802,6 +36802,8 @@ MessageReceiver.prototype = { // user they received an invalid message request.respond(200, 'OK'); + console.log('envelope', envelope.source + '.' + envelope.sourceDevice, envelope.timestamp); + if (envelope.type === textsecure.protobuf.Envelope.Type.RECEIPT) { return this.onDeliveryReceipt(envelope); } else if (envelope.content) { @@ -36809,7 +36811,7 @@ MessageReceiver.prototype = { } else if (envelope.legacyMessage) { return this.handleLegacyMessage(envelope); } else { - throw new Error('Received message with no content and no legacyMessage'); + throw new Error('Received envelope with no content and no legacyMessage'); } }.bind(this)).catch(function(e) { @@ -36919,8 +36921,10 @@ MessageReceiver.prototype = { this.handleContacts(syncMessage.contacts); } else if (syncMessage.groups) { this.handleGroups(syncMessage.groups); + } else if (syncMessage.request) { + console.log('Got SyncMessage Request'); } else { - throw new Error('Got SyncMessage with no sent, contacts, or groups'); + throw new Error('Got empty SyncMessage'); } }, handleContacts: function(contacts) { diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index 4b70fdc2..71bdf959 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -70,6 +70,8 @@ MessageReceiver.prototype = { // user they received an invalid message request.respond(200, 'OK'); + console.log('envelope', envelope.source + '.' + envelope.sourceDevice, envelope.timestamp); + if (envelope.type === textsecure.protobuf.Envelope.Type.RECEIPT) { return this.onDeliveryReceipt(envelope); } else if (envelope.content) { @@ -77,7 +79,7 @@ MessageReceiver.prototype = { } else if (envelope.legacyMessage) { return this.handleLegacyMessage(envelope); } else { - throw new Error('Received message with no content and no legacyMessage'); + throw new Error('Received envelope with no content and no legacyMessage'); } }.bind(this)).catch(function(e) { @@ -187,8 +189,10 @@ MessageReceiver.prototype = { this.handleContacts(syncMessage.contacts); } else if (syncMessage.groups) { this.handleGroups(syncMessage.groups); + } else if (syncMessage.request) { + console.log('Got SyncMessage Request'); } else { - throw new Error('Got SyncMessage with no sent, contacts, or groups'); + throw new Error('Got empty SyncMessage'); } }, handleContacts: function(contacts) {