remove buildSessionRequest message

pull/1183/head
Audric Ackermann 5 years ago
parent 1fe0e3a815
commit fbba5575ba
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1956,7 +1956,7 @@
}); });
// send a session request for all the members we do not have a session with // send a session request for all the members we do not have a session with
window.libloki.api.sendSessionRequestsToMembers(updates.members); await window.libloki.api.sendSessionRequestsToMembers(updates.members);
const { expireTimer } = details; const { expireTimer } = details;
const isValidExpireTimer = typeof expireTimer === 'number'; const isValidExpireTimer = typeof expireTimer === 'number';

@ -1720,6 +1720,7 @@
await libsession.getMessageQueue().sendToGroup(expirationTimerMessage); await libsession.getMessageQueue().sendToGroup(expirationTimerMessage);
} }
return message;
}, },
isSearchable() { isSearchable() {

@ -1,4 +1,4 @@
/* global window, textsecure, dcodeIO, StringView, ConversationController, _, libsession */ /* global window, textsecure, dcodeIO, StringView, ConversationController, libsession */
/* eslint-disable no-bitwise */ /* eslint-disable no-bitwise */
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
@ -172,24 +172,15 @@
}); });
return syncMessage; return syncMessage;
} }
function sendSessionRequestsToMembers(members = []) { async function sendSessionRequestsToMembers(members = []) {
// For every member, see if we need to establish a session: // For every member, trigger a session request if needed
members.forEach(memberPubKey => { members.forEach(async memberStr => {
const haveSession = _.some(
textsecure.storage.protocol.sessions,
s => s.number === memberPubKey
);
const ourPubKey = textsecure.storage.user.getNumber(); const ourPubKey = textsecure.storage.user.getNumber();
if (!haveSession && memberPubKey !== ourPubKey) { if (memberStr !== ourPubKey) {
// eslint-disable-next-line more/no-then await ConversationController.getOrCreateAndWait(memberStr, 'private');
ConversationController.getOrCreateAndWait(memberPubKey, 'private').then( const memberPubkey = new libsession.Types.PubKey(memberStr);
() => { await libsession.Protocols.SessionProtocol.sendSessionRequestIfNeeded(
const sessionRequestMessage = textsecure.OutgoingMessage.buildSessionRequestMessage( memberPubkey
memberPubKey
);
sessionRequestMessage.sendToNumber(memberPubKey);
}
); );
} }
}); });

@ -644,33 +644,6 @@ OutgoingMessage.prototype = {
}, },
}; };
OutgoingMessage.buildSessionRequestMessage = function buildSessionRequestMessage(
pubKey
) {
const body =
'(If you see this message, you must be using an out-of-date client)';
const flags = textsecure.protobuf.DataMessage.Flags.SESSION_REQUEST;
const dataMessage = new textsecure.protobuf.DataMessage({ flags, body });
const content = new textsecure.protobuf.Content({
dataMessage,
});
const options = {};
// Send a empty message with information about how to contact us directly
return new OutgoingMessage(
null, // server
Date.now(), // timestamp,
[pubKey], // numbers
content, // message
true, // silent
() => null, // callback
options
);
};
OutgoingMessage.DebugMessageType = DebugMessageType; OutgoingMessage.DebugMessageType = DebugMessageType;
window.textsecure = window.textsecure || {}; window.textsecure = window.textsecure || {};

@ -111,7 +111,7 @@ export async function preprocessGroupMessage(
} }
} }
// send a session request for all the members we do not have a session with // send a session request for all the members we do not have a session with
window.libloki.api.sendSessionRequestsToMembers(group.members); await window.libloki.api.sendSessionRequestsToMembers(group.members);
} else if (newGroup) { } else if (newGroup) {
// We have an unknown group, we should request info from the sender // We have an unknown group, we should request info from the sender
const requestInfo = { const requestInfo = {

Loading…
Cancel
Save