Update json formatting for legacy message requests

Legacy DataMessages are sent using the `body` field, new Content
messages are sent using the `content` field.

// FREEBIE
This commit is contained in:
lilia 2015-06-15 19:30:42 -07:00
parent a833d62a71
commit 228ffe901d
3 changed files with 22 additions and 10 deletions

View file

@ -74,7 +74,7 @@ window.textsecure.messaging = function() {
type: encryptedMsg.type,
destinationDeviceId: textsecure.utils.unencodeNumber(deviceObjectList[i].encodedNumber)[1],
destinationRegistrationId: registrationId,
body: encryptedMsg.body,
content: encryptedMsg.body,
timestamp: timestamp
};
@ -88,7 +88,8 @@ window.textsecure.messaging = function() {
for (var i = 0; i < deviceObjectList.length; i++)
promises[i] = addEncryptionFor(i);
return Promise.all(promises).then(function() {
return TextSecureServer.sendMessages(number, jsonData);
var legacy = (message instanceof textsecure.protobuf.DataMessage);
return TextSecureServer.sendMessages(number, jsonData, legacy);
});
}