|
|
|
@ -38140,6 +38140,15 @@ axolotlInternal.RecipientRecord = function() {
|
|
|
|
|
delete tempKeys[encodedNumber];
|
|
|
|
|
return Promise.resolve();
|
|
|
|
|
},
|
|
|
|
|
needKeysForDevice: function(encodedNumber) {
|
|
|
|
|
if (tempKeys[encodedNumber] !== undefined) {
|
|
|
|
|
return Promise.resolve(false);
|
|
|
|
|
} else {
|
|
|
|
|
return textsecure.protocol_wrapper.hasOpenSession(encodedNumber).then(function(result) {
|
|
|
|
|
return !result;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getDeviceObjectsForNumber: function(number) {
|
|
|
|
|
return textsecure.storage.axolotl.getIdentityKey(number).then(function(identityKey) {
|
|
|
|
@ -39805,8 +39814,8 @@ OutgoingMessage.prototype = {
|
|
|
|
|
sendToNumber: function(number) {
|
|
|
|
|
return textsecure.storage.devices.getDeviceObjectsForNumber(number).then(function(devicesForNumber) {
|
|
|
|
|
return Promise.all(devicesForNumber.map(function(device) {
|
|
|
|
|
return textsecure.protocol_wrapper.hasOpenSession(device.encodedNumber).then(function(result) {
|
|
|
|
|
if (!result) {
|
|
|
|
|
return textsecure.storage.devices.needKeysForDevice(device.encodedNumber).then(function(result) {
|
|
|
|
|
if (result) {
|
|
|
|
|
return this.getKeysForNumber(number,
|
|
|
|
|
[parseInt(textsecure.utils.unencodeNumber(device.encodedNumber)[1])]
|
|
|
|
|
).catch(function(error) {
|
|
|
|
|