include endSession message with new pipeline

pull/1183/head
Audric Ackermann 5 years ago
parent 908316f00d
commit 029851400d
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1803,15 +1803,20 @@
type: 'outgoing',
endSessionType: 'ongoing',
});
await message.send(
this.wrapSend(
textsecure.messaging.resetSession(
this.id,
message.get('sent_at'),
{}
)
)
window.log.info('resetting secure session');
const device = new libsession.Types.PubKey(this.id);
const preKeyBundle = await window.libloki.storage.getPreKeyBundleForContact(
device.key
);
const endSessionMessage = new libsession.Messages.Outgoing.EndSessionMessage(
{
timestamp: message.get('sent_at'),
preKeyBundle,
}
);
await libsession.getMessageQueue().send(device, endSessionMessage);
// TODO handle errors to reset session reset status with the new pipeline
if (message.hasErrors()) {
await this.setSessionResetStatus(SessionResetEnum.none);
}

@ -969,31 +969,6 @@ MessageSender.prototype = {
options
);
},
resetSession(number, timestamp, options) {
window.log.info('resetting secure session');
const silent = false;
const proto = new textsecure.protobuf.DataMessage();
proto.body = 'TERMINATE';
proto.flags = textsecure.protobuf.DataMessage.Flags.END_SESSION;
const logError = prefix => error => {
window.log.error(prefix, error && error.stack ? error.stack : error);
throw error;
};
// The actual deletion of the session now happens later
// as we need to ensure the other contact has successfully
// switch to a new session first.
return this.sendIndividualProto(
number,
proto,
timestamp,
silent,
options
).catch(logError('resetSession/sendToContact error:'));
},
async sendMessageToGroup(
groupId,
groupNumbers,
@ -1166,7 +1141,6 @@ textsecure.MessageSender = function MessageSenderWrapper(username, password) {
);
this.sendMessageToNumber = sender.sendMessageToNumber.bind(sender);
this.sendMessage = sender.sendMessage.bind(sender);
this.resetSession = sender.resetSession.bind(sender);
this.sendMessageToGroup = sender.sendMessageToGroup.bind(sender);
this.sendGroupUpdate = sender.sendGroupUpdate.bind(sender);
this.updateMediumGroup = sender.updateMediumGroup.bind(sender);

@ -603,7 +603,10 @@ export async function handleMessageEvent(event: any): Promise<void> {
const isOurDevice = await MultiDeviceProtocol.isOurDevice(source);
const shouldSendReceipt =
isIncoming && data.unidentifiedDeliveryReceived && !isGroupMessage && !isOurDevice;
isIncoming &&
data.unidentifiedDeliveryReceived &&
!isGroupMessage &&
!isOurDevice;
if (shouldSendReceipt) {
await sendDeliveryReceipt(source, data.timestamp);

Loading…
Cancel
Save