From b00d5289cf2fdce51e0f30a44623c6d5a5be64d6 Mon Sep 17 00:00:00 2001 From: lilia Date: Sun, 29 Nov 2015 11:25:27 -0800 Subject: [PATCH] Save message timestamp for resending Fix bug where resending due to failed network connection would fail silently. Broken in 7b6820 refactor which changed arguments to transmitMessage // FREEBIE --- js/libtextsecure.js | 6 +++--- libtextsecure/errors.js | 4 ++-- libtextsecure/outgoing_message.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 4f7113cbe..05fe834a1 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -74,10 +74,10 @@ OutgoingMessageError.prototype = new ReplayableError(); OutgoingMessageError.prototype.constructor = OutgoingMessageError; - function SendMessageNetworkError(number, jsonData, httpError) { + function SendMessageNetworkError(number, jsonData, httpError, timestamp) { ReplayableError.call(this, { functionCode : Type.TRANSMIT_MESSAGE, - args : [number, jsonData] + args : [number, jsonData, timestamp] }); this.name = 'SendMessageNetworkError'; this.number = number; @@ -37249,7 +37249,7 @@ OutgoingMessage.prototype = { if (e.name === 'HTTPError' && (e.code !== 409 && e.code !== 410)) { // 409 and 410 should bubble and be handled by doSendMessage // all other network errors can be retried later. - throw new textsecure.SendMessageNetworkError(number, jsonData, e); + throw new textsecure.SendMessageNetworkError(number, jsonData, e, timestamp); } throw e; }); diff --git a/libtextsecure/errors.js b/libtextsecure/errors.js index d023fce3b..f3521151b 100644 --- a/libtextsecure/errors.js +++ b/libtextsecure/errors.js @@ -73,10 +73,10 @@ OutgoingMessageError.prototype = new ReplayableError(); OutgoingMessageError.prototype.constructor = OutgoingMessageError; - function SendMessageNetworkError(number, jsonData, httpError) { + function SendMessageNetworkError(number, jsonData, httpError, timestamp) { ReplayableError.call(this, { functionCode : Type.TRANSMIT_MESSAGE, - args : [number, jsonData] + args : [number, jsonData, timestamp] }); this.name = 'SendMessageNetworkError'; this.number = number; diff --git a/libtextsecure/outgoing_message.js b/libtextsecure/outgoing_message.js index 51230af0b..194cb7b9e 100644 --- a/libtextsecure/outgoing_message.js +++ b/libtextsecure/outgoing_message.js @@ -91,7 +91,7 @@ OutgoingMessage.prototype = { if (e.name === 'HTTPError' && (e.code !== 409 && e.code !== 410)) { // 409 and 410 should bubble and be handled by doSendMessage // all other network errors can be retried later. - throw new textsecure.SendMessageNetworkError(number, jsonData, e); + throw new textsecure.SendMessageNetworkError(number, jsonData, e, timestamp); } throw e; });