From 9f82a37d8b16efc30da5987bc9246d8e0c8ba890 Mon Sep 17 00:00:00 2001 From: Lilia Date: Tue, 26 Sep 2017 01:42:56 +0200 Subject: [PATCH] Log call messages instead of throwing error (#1504) Rather than throw an error, just log call messages and drop them. This way we distinguish them from incorrectly encoded content messages or new types of messages we don't support yet, and don't insert unnecessary red flags and stacktraces in debug logs. // FREEBIE --- js/libtextsecure.js | 6 ++++++ libtextsecure/message_receiver.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 72592fb6e08b..63f7ba9b2688 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -38837,11 +38837,17 @@ MessageReceiver.prototype.extend({ return this.handleDataMessage(envelope, content.dataMessage); } else if (content.nullMessage) { return this.handleNullMessage(envelope, content.nullMessage); + } else if (content.callMessage) { + return this.handleCallMessage(envelope, content.callMessage); } else { this.removeFromCache(envelope); throw new Error('Unsupported content message'); } }, + handleCallMessage: function(envelope, nullMessage) { + console.log('call message from', this.getEnvelopeId(envelope)); + this.removeFromCache(envelope); + }, handleNullMessage: function(envelope, nullMessage) { console.log('null message from', this.getEnvelopeId(envelope)); this.removeFromCache(envelope); diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index b8c66f2b0384..de3026a01eeb 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -483,11 +483,17 @@ MessageReceiver.prototype.extend({ return this.handleDataMessage(envelope, content.dataMessage); } else if (content.nullMessage) { return this.handleNullMessage(envelope, content.nullMessage); + } else if (content.callMessage) { + return this.handleCallMessage(envelope, content.callMessage); } else { this.removeFromCache(envelope); throw new Error('Unsupported content message'); } }, + handleCallMessage: function(envelope, nullMessage) { + console.log('call message from', this.getEnvelopeId(envelope)); + this.removeFromCache(envelope); + }, handleNullMessage: function(envelope, nullMessage) { console.log('null message from', this.getEnvelopeId(envelope)); this.removeFromCache(envelope);