replace unlink message

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

@ -1407,7 +1407,10 @@
); );
await window.lokiFileServerAPI.updateOurDeviceMapping(); await window.lokiFileServerAPI.updateOurDeviceMapping();
// TODO: we should ensure the message was sent and retry automatically if not // TODO: we should ensure the message was sent and retry automatically if not
await libloki.api.sendUnpairingMessageToSecondary(pubKey); const device = new libsession.Types.PubKey(pubKey);
const unlinkMessage = new libsession.Messages.Outgoing.DeviceUnlinkMessage(pubKey);
await libsession.messageQueue.send(device, unlinkMessage);
// Remove all traces of the device // Remove all traces of the device
setTimeout(() => { setTimeout(() => {
ConversationController.deleteContact(pubKey); ConversationController.deleteContact(pubKey);

@ -70,13 +70,6 @@
); );
await backgroundMessage.sendToNumber(pubKey, false); await backgroundMessage.sendToNumber(pubKey, false);
} }
function sendUnpairingMessageToSecondary(pubKey) {
const unpairingMessage = textsecure.OutgoingMessage.buildUnpairingMessage(
pubKey
);
return unpairingMessage.sendToNumber(pubKey, false);
}
// Serialise as <Element0.length><Element0><Element1.length><Element1>... // Serialise as <Element0.length><Element0><Element1.length><Element1>...
// This is an implementation of the reciprocal of contacts_parser.js // This is an implementation of the reciprocal of contacts_parser.js
function serialiseByteBuffers(buffers) { function serialiseByteBuffers(buffers) {
@ -222,7 +215,6 @@
sendSessionEstablishedMessage, sendSessionEstablishedMessage,
sendBackgroundMessage, sendBackgroundMessage,
sendSessionRequestsToMembers, sendSessionRequestsToMembers,
sendUnpairingMessageToSecondary,
createContactSyncProtoMessage, createContactSyncProtoMessage,
createGroupSyncProtoMessage, createGroupSyncProtoMessage,
createOpenGroupsSyncProtoMessage, createOpenGroupsSyncProtoMessage,

@ -723,28 +723,6 @@ OutgoingMessage.buildBackgroundMessage = function buildBackgroundMessage(
); );
}; };
OutgoingMessage.buildUnpairingMessage = function buildUnpairingMessage(pubKey) {
const flags = textsecure.protobuf.DataMessage.Flags.UNPAIRING_REQUEST;
const dataMessage = new textsecure.protobuf.DataMessage({
flags,
});
const content = new textsecure.protobuf.Content({
dataMessage,
});
const debugMessageType = DebugMessageType.DEVICE_UNPAIRING_SEND;
const options = { messageType: 'device-unpairing', debugMessageType };
const outgoingMessage = new textsecure.OutgoingMessage(
null, // server
Date.now(), // timestamp,
[pubKey], // numbers
content, // message
true, // silent
() => null, // callback
options
);
return outgoingMessage;
};
OutgoingMessage.DebugMessageType = DebugMessageType; OutgoingMessage.DebugMessageType = DebugMessageType;
window.textsecure = window.textsecure || {}; window.textsecure = window.textsecure || {};

Loading…
Cancel
Save