Merge pull request #590 from BeaudanBrown/session-reset-on-fr

Session reset on fr
pull/612/head
Beaudan Campbell-Brown 6 years ago committed by GitHub
commit 6611a10855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1029,6 +1029,10 @@
messageReceiver.addEventListener('configuration', onConfiguration);
messageReceiver.addEventListener('typing', onTyping);
Whisper.events.on('endSession', source => {
messageReceiver.handleEndSession(source);
});
window.Signal.AttachmentDownloads.start({
getMessageReceiver: () => messageReceiver,
logger: window.log,

@ -840,7 +840,7 @@
response: 'accepted',
status: ['pending', 'expired'],
});
window.libloki.api.sendOnlineBroadcastMessage(this.id);
window.libloki.api.sendBackgroundMessage(this.id);
return true;
}
return false;
@ -1880,7 +1880,7 @@
await this.setSessionResetStatus(SessionResetEnum.request_received);
// send empty message, this will trigger the new session to propagate
// to the reset initiator.
await window.libloki.api.sendBackgroundMessage(this.id);
window.libloki.api.sendBackgroundMessage(this.id);
},
isSessionResetReceived() {
@ -1916,7 +1916,7 @@
async onNewSessionAdopted() {
if (this.get('sessionResetStatus') === SessionResetEnum.initiated) {
// send empty message to confirm that we have adopted the new session
await window.libloki.api.sendBackgroundMessage(this.id);
window.libloki.api.sendBackgroundMessage(this.id);
}
await this.createAndStoreEndSessionMessage({
type: 'incoming',

@ -2175,15 +2175,18 @@
- We sent the user a friend request and that user sent us a friend request.
- We are friends with the user, and that user just sent us a friend request.
*/
if (
conversation.hasSentFriendRequest() ||
conversation.isFriend()
) {
// Automatically accept incoming friend requests if we have send one already
autoAccept = true;
const isFriend = conversation.isFriend();
const hasSentFriendRequest = conversation.hasSentFriendRequest();
autoAccept = isFriend || hasSentFriendRequest;
if (autoAccept) {
message.set({ friendStatus: 'accepted' });
}
if (isFriend) {
window.Whisper.events.trigger('endSession', source);
} else if (hasSentFriendRequest) {
await conversation.onFriendRequestAccepted();
window.libloki.api.sendBackgroundMessage(message.get('source'));
} else {
await conversation.onFriendRequestReceived();
}

@ -1479,11 +1479,6 @@ MessageReceiver.prototype.extend({
window.log.error('Error getting conversation: ', number);
}
// Bail early if a session reset is already ongoing
if (conversation.isSessionResetOngoing()) {
return;
}
await Promise.all(
deviceIds.map(async deviceId => {
const address = new libsignal.SignalProtocolAddress(number, deviceId);
@ -1669,6 +1664,9 @@ textsecure.MessageReceiver = function MessageReceiverWrapper(
messageReceiver
);
this.getStatus = messageReceiver.getStatus.bind(messageReceiver);
this.handleEndSession = messageReceiver.handleEndSession.bind(
messageReceiver
);
this.close = messageReceiver.close.bind(messageReceiver);
this.savePreKeyBundleMessage = messageReceiver.savePreKeyBundleMessage.bind(
messageReceiver

Loading…
Cancel
Save