address reviews

pull/1183/head
Audric Ackermann 5 years ago
parent 9baefb573e
commit 6a13839d9d
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -1735,18 +1735,18 @@
};
if (this.get('type') === 'private') {
const expirationTimerMessage = new new libsession.Messages.Outgoing.ExpirationTimerUpdateMessage(
const expirationTimerMessage = new libsession.Messages.Outgoing.ExpirationTimerUpdateMessage(
expireUpdate
)();
);
const pubkey = new libsession.Types.PubKey(this.get('id'));
await libsession
.getMessageQueue()
.sendUsingMultiDevice(this.get('id'), expirationTimerMessage);
.sendUsingMultiDevice(pubkey, expirationTimerMessage);
} else {
expireUpdate.groupId = this.get('id');
const expirationTimerMessage = new new libsession.Messages.Outgoing.ExpirationTimerUpdateMessage(
const expirationTimerMessage = new libsession.Messages.Outgoing.ExpirationTimerUpdateMessage(
expireUpdate
)();
);
await libsession.getMessageQueue().sendToGroup(expirationTimerMessage);
}
@ -1922,18 +1922,10 @@
const groupUpdateMessage = new libsession.Messages.Outgoing.ClosedGroupUpdateMessage(
updateParams
);
groupUpdate.recipients.forEach(r => {
const recipientPubKey = new libsession.Types.PubKey(r);
if (!recipientPubKey) {
window.console.warn('updateGroup invalid pubkey:', r);
return;
}
libsession
.getMessageQueue()
.sendUsingMultiDevice(recipientPubKey, groupUpdateMessage)
.ignore();
});
libsession
.getMessageQueue()
.sendToGroup(groupUpdateMessage)
.ignore();
},
sendGroupInfo(recipient) {
@ -1997,9 +1989,9 @@
timestamp: Date.now(),
groupId: this.id,
};
const quitGroupMessage = new new libsession.Messages.Outgoing.ClosedGroupLeaveMessage(
const quitGroupMessage = new libsession.Messages.Outgoing.ClosedGroupLeaveMessage(
quitGroup
)();
);
await libsession.getMessageQueue().sendToGroup(quitGroupMessage);

@ -1,4 +1,4 @@
/* global window, textsecure, dcodeIO, StringView, ConversationController, libsession */
/* global window, textsecure, dcodeIO, StringView, libsession */
/* eslint-disable no-bitwise */
// eslint-disable-next-line func-names
@ -55,7 +55,7 @@
}
async function sendSessionEstablishedMessage(pubKey) {
const user = libsession.Types.PubKey.from(pubKey);
const user = new libsession.Types.PubKey(pubKey);
const sessionEstablished = new window.libsession.Messages.Outgoing.SessionEstablishedMessage(
{ timestamp: Date.now() }
@ -177,7 +177,6 @@
members.forEach(async memberStr => {
const ourPubKey = textsecure.storage.user.getNumber();
if (memberStr !== ourPubKey) {
await ConversationController.getOrCreateAndWait(memberStr, 'private');
const memberPubkey = new libsession.Types.PubKey(memberStr);
await libsession.Protocols.SessionProtocol.sendSessionRequestIfNeeded(
memberPubkey

@ -546,7 +546,7 @@
libloki.crypto.PairingType.REQUEST
);
const primaryDevice = libsession.Types.PubKey.from(primaryDevicePubKey);
const primaryDevice = new libsession.Types.PubKey(primaryDevicePubKey);
const requestPairingMessage = new window.libsession.Messages.Outgoing.DeviceLinkRequestMessage(
{

@ -1121,23 +1121,11 @@ MessageReceiver.prototype.extend({
signature,
};
const signedKeyPromise = textsecure.storage.protocol.storeContactSignedPreKey(
pubkey,
signedPreKey
);
const preKeyObject = {
publicKey: preKey,
keyId: preKeyId,
};
const preKeyPromise = textsecure.storage.protocol.storeContactPreKey(
pubkey,
preKeyObject
);
await Promise.all([signedKeyPromise, preKeyPromise]);
const device = {
identityKey,
deviceId,

@ -212,7 +212,7 @@ OutgoingMessage.prototype = {
)
// Don't send to ourselves
.then(devicesPubKeys =>
devicesPubKeys.filter(pubKey => pubKey !== ourNumber)
devicesPubKeys.filter(pubKey => pubKey.key !== ourNumber)
)
.then(devicesPubKeys => {
if (devicesPubKeys.length === 0) {

@ -1,6 +1,7 @@
import { SignalService } from '../protobuf';
import { ClosedGroupRequestInfoMessage } from '../session/messages/outgoing/content/data/group/ClosedGroupRequestInfoMessage';
import { getMessageQueue } from '../session';
import { PubKey } from '../session/types';
const _ = window.Lodash;
@ -119,7 +120,11 @@ export async function preprocessGroupMessage(
groupId: conversationId,
};
const requestInfoMessage = new ClosedGroupRequestInfoMessage(requestInfo);
await getMessageQueue().sendToGroup(requestInfoMessage);
const primarySourcePubKey = new PubKey(primarySource);
await getMessageQueue().sendUsingMultiDevice(
primarySourcePubKey,
requestInfoMessage
);
}
return false;
}

@ -13,18 +13,7 @@ export class ClosedGroupLeaveMessage extends ClosedGroupMessage {
});
}
public ttl(): number {
return this.getDefaultTTL();
}
protected groupContextType(): SignalService.GroupContext.Type {
return SignalService.GroupContext.Type.QUIT;
}
protected dataProto(): SignalService.DataMessage {
const messageProto = new SignalService.DataMessage();
messageProto.group = this.groupContext();
return messageProto;
}
}

@ -13,18 +13,7 @@ export class ClosedGroupRequestInfoMessage extends ClosedGroupMessage {
});
}
public ttl(): number {
return this.getDefaultTTL();
}
protected groupContextType(): SignalService.GroupContext.Type {
return SignalService.GroupContext.Type.REQUEST_INFO;
}
protected dataProto(): SignalService.DataMessage {
const messageProto = new SignalService.DataMessage();
messageProto.group = this.groupContext();
return messageProto;
}
}

@ -25,7 +25,7 @@ export abstract class RequestSyncMessage extends SyncMessage {
}
protected syncProto(): SignalService.SyncMessage {
const syncMessage = this.createSyncMessage();
const syncMessage = super.syncProto();
syncMessage.request = new SignalService.SyncMessage.Request({
type: this.requestType,
});

@ -13,7 +13,7 @@ export abstract class SyncMessage extends ContentMessage {
});
}
protected createSyncMessage(): SignalService.SyncMessage {
protected syncProto(): SignalService.SyncMessage {
const syncMessage = new SignalService.SyncMessage();
// Generate a random int from 1 and 512
@ -27,6 +27,4 @@ export abstract class SyncMessage extends ContentMessage {
return syncMessage;
}
protected abstract syncProto(): SignalService.SyncMessage;
}

Loading…
Cancel
Save