From c112c59ce609103d4dc630a1f7875c6061998396 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 15 Jan 2015 19:58:18 -1000 Subject: [PATCH] Fix group send (fixes #129) --- js/libtextsecure.js | 6 ++++-- libtextsecure/sendmessage.js | 6 ++++-- libtextsecure/test/testvectors.js | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/js/libtextsecure.js b/js/libtextsecure.js index 5c741168..45d5528d 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -8183,8 +8183,7 @@ window.textsecure.messaging = function() { }); } - for (var i in numbers) { - var number = numbers[i]; + var getDevicesAndSendToNumber = function(number) { var devicesForNumber = textsecure.storage.devices.getDeviceObjectsForNumber(number); var promises = []; @@ -8205,6 +8204,9 @@ window.textsecure.messaging = function() { doSendMessage(number, devicesForNumber, true); }); } + + for (var i in numbers) + getDevicesAndSendToNumber(numbers[i]); } makeAttachmentPointer = function(attachment) { diff --git a/libtextsecure/sendmessage.js b/libtextsecure/sendmessage.js index 49eb14ec..25018fdd 100644 --- a/libtextsecure/sendmessage.js +++ b/libtextsecure/sendmessage.js @@ -203,8 +203,7 @@ window.textsecure.messaging = function() { }); } - for (var i in numbers) { - var number = numbers[i]; + var getDevicesAndSendToNumber = function(number) { var devicesForNumber = textsecure.storage.devices.getDeviceObjectsForNumber(number); var promises = []; @@ -225,6 +224,9 @@ window.textsecure.messaging = function() { doSendMessage(number, devicesForNumber, true); }); } + + for (var i in numbers) + getDevicesAndSendToNumber(numbers[i]); } makeAttachmentPointer = function(attachment) { diff --git a/libtextsecure/test/testvectors.js b/libtextsecure/test/testvectors.js index 69d8eb33..aa7f9346 100644 --- a/libtextsecure/test/testvectors.js +++ b/libtextsecure/test/testvectors.js @@ -464,5 +464,8 @@ axolotlTestVectors = function() { tests[tests.length] = {name: "No-PreKey fake end-session test as Bob", vectors: axolotlNoPreKeyEndSessionTestVectorsBob}; */ + + //TODO: GROUPS + return tests; }();