More typos from me being too tired
This commit is contained in:
parent
5cea7b6857
commit
1724d122d3
2 changed files with 36 additions and 38 deletions
|
@ -360,14 +360,14 @@ window.textsecure.storage = function() {
|
||||||
|
|
||||||
var newDevices = [];
|
var newDevices = [];
|
||||||
var devicesRemoved = 0;
|
var devicesRemoved = 0;
|
||||||
for (device in map.devices) {
|
for (i in map.devices) {
|
||||||
var keep = true;
|
var keep = true;
|
||||||
for (idToRemove in deviceIdsToRemove)
|
for (idToRemove in deviceIdsToRemove)
|
||||||
if (device.deviceId == idToRemove)
|
if (map.devices[i].deviceId == idToRemove)
|
||||||
keep = false;
|
keep = false;
|
||||||
|
|
||||||
if (keep)
|
if (keep)
|
||||||
newDevices.push(device);
|
newDevices.push(map.devices[i]);
|
||||||
else
|
else
|
||||||
devicesRemoved++;
|
devicesRemoved++;
|
||||||
}
|
}
|
||||||
|
@ -510,24 +510,24 @@ window.textsecure.sendMessage = function() {
|
||||||
function getKeysForNumber(number, updateDevices) {
|
function getKeysForNumber(number, updateDevices) {
|
||||||
return textsecure.api.getKeysForNumber(number).then(function(response) {
|
return textsecure.api.getKeysForNumber(number).then(function(response) {
|
||||||
var identityKey = getString(response[0].identityKey);
|
var identityKey = getString(response[0].identityKey);
|
||||||
for (device in response)
|
for (i in response)
|
||||||
if (getString(device.identityKey) != identityKey)
|
if (getString(response[i].identityKey) != identityKey)
|
||||||
throw new Error("Identity key changed");
|
throw new Error("Identity key changed");
|
||||||
|
|
||||||
for (device in response) {
|
for (i in response) {
|
||||||
var updateDevice = (updateDevices === undefined);
|
var updateDevice = (updateDevices === undefined);
|
||||||
if (!updateDevice)
|
if (!updateDevice)
|
||||||
for (deviceId in updateDevices)
|
for (deviceId in updateDevices)
|
||||||
if (deviceId == device.deviceId)
|
if (deviceId == response[i].deviceId)
|
||||||
updateDevice = true;
|
updateDevice = true;
|
||||||
|
|
||||||
if (updateDevice)
|
if (updateDevice)
|
||||||
textsecure.storage.devices.saveDeviceObject({
|
textsecure.storage.devices.saveDeviceObject({
|
||||||
encodedNumber: number + "." + device.deviceId,
|
encodedNumber: number + "." + response[i].deviceId,
|
||||||
identityKey: device.identityKey,
|
identityKey: response[i].identityKey,
|
||||||
publicKey: device.publicKey,
|
publicKey: response[i].publicKey,
|
||||||
preKeyId: device.keyId,
|
preKeyId: response[i].keyId,
|
||||||
registrationId: device.registrationId
|
registrationId: response[i].registrationId
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -541,31 +541,29 @@ window.textsecure.sendMessage = function() {
|
||||||
var promises = [];
|
var promises = [];
|
||||||
|
|
||||||
var addEncryptionFor = function(i) {
|
var addEncryptionFor = function(i) {
|
||||||
return new Promise(function(resolve) { // Wrap in a promise for the direct throws
|
if (deviceObjectList[i].relay !== undefined) {
|
||||||
if (deviceObjectList[i].relay !== undefined) {
|
if (relay === undefined)
|
||||||
if (relay === undefined)
|
relay = deviceObjectList[i].relay;
|
||||||
relay = deviceObjectList[i].relay;
|
else if (relay != deviceObjectList[i].relay)
|
||||||
else if (relay != deviceObjectList[i].relay)
|
return new Promise(function() { throw new Error("Mismatched relays for number " + number); });
|
||||||
throw new Error("Mismatched relays for number " + number);
|
} else {
|
||||||
} else {
|
if (relay === undefined)
|
||||||
if (relay === undefined)
|
relay = "";
|
||||||
relay = "";
|
else if (relay != "")
|
||||||
else if (relay != "")
|
return new Promise(function() { throw new Error("Mismatched relays for number " + number); });
|
||||||
throw new Error("Mismatched relays for number " + number);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return textsecure.crypto.encryptMessageFor(deviceObjectList[i], message).then(function(encryptedMsg) {
|
return textsecure.crypto.encryptMessageFor(deviceObjectList[i], message).then(function(encryptedMsg) {
|
||||||
jsonData[i] = {
|
jsonData[i] = {
|
||||||
type: encryptedMsg.type,
|
type: encryptedMsg.type,
|
||||||
destination: deviceObjectList[i].encodedNumber,
|
destination: deviceObjectList[i].encodedNumber,
|
||||||
destinationRegistrationId: deviceObjectList[i].registrationId,
|
destinationRegistrationId: deviceObjectList[i].registrationId,
|
||||||
body: encryptedMsg.body,
|
body: encryptedMsg.body,
|
||||||
timestamp: new Date().getTime()
|
timestamp: new Date().getTime()
|
||||||
};
|
};
|
||||||
|
|
||||||
if (deviceObjectList[i].relay !== undefined)
|
if (deviceObjectList[i].relay !== undefined)
|
||||||
jsonData[i].relay = deviceObjectList[i].relay;
|
jsonData[i].relay = deviceObjectList[i].relay;
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,8 +604,8 @@ window.textsecure.sendMessage = function() {
|
||||||
resetDevices = resetDevices.concat(error.response.extraDevices);
|
resetDevices = resetDevices.concat(error.response.extraDevices);
|
||||||
|
|
||||||
textsecure.storage.devices.removeDeviceIdsForNumber(number, resetDevices);
|
textsecure.storage.devices.removeDeviceIdsForNumber(number, resetDevices);
|
||||||
for (deviceId in resetDevices)
|
for (i in resetDevices)
|
||||||
textsecure.crypto.forceRemoveAllSessions(number + "." + resetDevices);
|
textsecure.crypto.forceRemoveAllSessions(number + "." + resetDevices[i]);
|
||||||
|
|
||||||
//TODO: Try again
|
//TODO: Try again
|
||||||
}).catch(function(error) {
|
}).catch(function(error) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ var Whisper = Whisper || {};
|
||||||
var splitString = $("#send_numbers").val().split(",");
|
var splitString = $("#send_numbers").val().split(",");
|
||||||
for (var i = 0; i < splitString.length; i++) {
|
for (var i = 0; i < splitString.length; i++) {
|
||||||
try {
|
try {
|
||||||
numbers.push(verifyNumber(splitString[i]));
|
numbers.push(textsecure.utils.verifyNumber(splitString[i]));
|
||||||
} catch (numberError) {
|
} catch (numberError) {
|
||||||
alert(numberError);
|
alert(numberError);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue