|
|
|
@ -114,12 +114,25 @@ window.textsecure.messaging = function() {
|
|
|
|
|
return Promise.all(promises);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var tryMessageAgain = function(number, encodedMessage, callback) {
|
|
|
|
|
//TODO: Wipe identity key!
|
|
|
|
|
refreshGroups(number).then(function() {
|
|
|
|
|
var message = textsecure.protobuf.PushMessageContent.decode(encodedMessage);
|
|
|
|
|
textsecure.sendMessageProto([number], message, callback);
|
|
|
|
|
});
|
|
|
|
|
var tryMessageAgain = function(number, encodedMessage, message_id) {
|
|
|
|
|
var message = new Whisper.MessageCollection().add({id: message_id});
|
|
|
|
|
message.fetch().then(function() {
|
|
|
|
|
textsecure.storage.removeEncrypted("devices" + number);
|
|
|
|
|
refreshGroups(number).then(function() {
|
|
|
|
|
var proto = textsecure.protobuf.PushMessageContent.decode(encodedMessage, 'binary');
|
|
|
|
|
sendMessageProto([number], proto, function(res) {
|
|
|
|
|
if (res.failure.length > 0) {
|
|
|
|
|
message.set('errors', []);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
message.set('errors', res.failures);
|
|
|
|
|
}
|
|
|
|
|
message.save().then(function(){
|
|
|
|
|
extension.trigger('message', message); // notify frontend listeners
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
textsecure.replay.registerFunction(tryMessageAgain, textsecure.replay.Type.SEND_MESSAGE);
|
|
|
|
|
|
|
|
|
@ -175,7 +188,7 @@ window.textsecure.messaging = function() {
|
|
|
|
|
if (error.message !== "Identity key changed")
|
|
|
|
|
registerError(number, "Failed to reload device keys", error);
|
|
|
|
|
else {
|
|
|
|
|
error = new textsecure.OutgoingIdentityKeyError(encodedNumber, message.encode());
|
|
|
|
|
error = new textsecure.OutgoingIdentityKeyError(number, getString(message.encode()));
|
|
|
|
|
registerError(number, "Identity key changed", error);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|