Sync end session messages

// FREEBIE
This commit is contained in:
lilia 2016-02-03 18:18:42 -08:00 committed by Lilia
parent cfe0c77243
commit 4842ef6153
2 changed files with 22 additions and 18 deletions

View file

@ -39263,17 +39263,19 @@ MessageSender.prototype = {
proto.body = "TERMINATE"; proto.body = "TERMINATE";
proto.flags = textsecure.protobuf.DataMessage.Flags.END_SESSION; proto.flags = textsecure.protobuf.DataMessage.Flags.END_SESSION;
return this.sendIndividualProto(number, proto, timestamp).then(function(res) { return this.sendIndividualProto(number, proto, timestamp).then(function(res) {
return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) { return this.sendSyncMessage(proto.toArrayBuffer(), timestamp, number).then(function() {
return Promise.all(deviceIds.map(function(deviceId) { return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
var address = new libsignal.SignalProtocolAddress(number, deviceId); return Promise.all(deviceIds.map(function(deviceId) {
console.log('closing session for', address.toString()); var address = new libsignal.SignalProtocolAddress(number, deviceId);
var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address); console.log('closing session for', address.toString());
return sessionCipher.closeOpenSessionForDevice(); var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
})).then(function() { return sessionCipher.closeOpenSessionForDevice();
return res; })).then(function() {
return res;
});
}); });
}); });
}); }.bind(this));
}, },
sendMessageToGroup: function(groupId, messageText, attachments, timestamp, expireTimer) { sendMessageToGroup: function(groupId, messageText, attachments, timestamp, expireTimer) {

View file

@ -338,17 +338,19 @@ MessageSender.prototype = {
proto.body = "TERMINATE"; proto.body = "TERMINATE";
proto.flags = textsecure.protobuf.DataMessage.Flags.END_SESSION; proto.flags = textsecure.protobuf.DataMessage.Flags.END_SESSION;
return this.sendIndividualProto(number, proto, timestamp).then(function(res) { return this.sendIndividualProto(number, proto, timestamp).then(function(res) {
return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) { return this.sendSyncMessage(proto.toArrayBuffer(), timestamp, number).then(function() {
return Promise.all(deviceIds.map(function(deviceId) { return textsecure.storage.protocol.getDeviceIds(number).then(function(deviceIds) {
var address = new libsignal.SignalProtocolAddress(number, deviceId); return Promise.all(deviceIds.map(function(deviceId) {
console.log('closing session for', address.toString()); var address = new libsignal.SignalProtocolAddress(number, deviceId);
var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address); console.log('closing session for', address.toString());
return sessionCipher.closeOpenSessionForDevice(); var sessionCipher = new libsignal.SessionCipher(textsecure.storage.protocol, address);
})).then(function() { return sessionCipher.closeOpenSessionForDevice();
return res; })).then(function() {
return res;
});
}); });
}); });
}); }.bind(this));
}, },
sendMessageToGroup: function(groupId, messageText, attachments, timestamp, expireTimer) { sendMessageToGroup: function(groupId, messageText, attachments, timestamp, expireTimer) {