pull/1211/head
Mikunj 5 years ago
parent fd547941d6
commit c422c9e2ad

@ -1394,7 +1394,9 @@
// Special-case the self-send case - we send only a sync message
if (members.length === 1) {
const isOurDevice = await libsession.Protocols.MultiDeviceProtocol.isOurDevice(members[0]);
const isOurDevice = await libsession.Protocols.MultiDeviceProtocol.isOurDevice(
members[0]
);
if (isOurDevice) {
await message.sendSyncMessageOnly(closedGroupChatMessage);
return true;
@ -1970,11 +1972,17 @@
try {
// Exclude our device from members and send them the message
const ourNumber = textsecure.storage.user.getNumber();
const primary = await libsession.Protocols.MultiDeviceProtocol.getPrimaryDevice(ourNumber);
const otherMembers = (members || []).filter(member => !primary.isEqual(member));
const primary = await libsession.Protocols.MultiDeviceProtocol.getPrimaryDevice(
ourNumber
);
const otherMembers = (members || []).filter(
member => !primary.isEqual(member)
);
const sendPromises = otherMembers.map(member => {
const memberPubKey = libsession.Types.PubKey.cast(member);
return libsession.getMessageQueue().sendUsingMultiDevice(memberPubKey, message);
return libsession
.getMessageQueue()
.sendUsingMultiDevice(memberPubKey, message);
});
await Promise.all(sendPromises);

@ -1101,7 +1101,9 @@
// Special-case the self-send case - we send only a sync message
if (recipients.length === 1) {
const isOurDevice = await libsession.Protocols.MultiDeviceProtocol.isOurDevice(recipients[0]);
const isOurDevice = await libsession.Protocols.MultiDeviceProtocol.isOurDevice(
recipients[0]
);
if (isOurDevice) {
return this.sendSyncMessageOnly(chatMessage);
}

@ -508,7 +508,7 @@ function createMessage(
}
function sendDeliveryReceipt(source: string, timestamp: any) {
// FIXME audric
// FIXME audric
// const receiptMessage = new DeliveryReceiptMessage({
// timestamp: Date.now(),
// timestamps: [timestamp],

@ -1,12 +1,9 @@
import { DataMessage } from '../DataMessage';
import { SignalService } from '../../../../../../protobuf';
import { StringUtils } from '../../../../../utils';
import {
ClosedGroupMessage,
ClosedGroupMessageParams,
} from './ClosedGroupMessage';
import { AttachmentPointer } from '../ChatMessage';
import { PubKey } from '../../../../../types';
export interface ClosedGroupUpdateMessageParams
extends ClosedGroupMessageParams {

@ -8,9 +8,18 @@ import ByteBuffer from 'bytebuffer';
*/
export function convertToTS(object: any): any {
// No idea why js `ByteBuffer` and ts `ByteBuffer` differ ...
if (object && object.constructor && object.constructor.name === 'ByteBuffer') {
if (
object &&
object.constructor &&
object.constructor.name === 'ByteBuffer'
) {
return new Uint8Array(object.toArrayBuffer());
} else if (object instanceof ByteBuffer || object instanceof Buffer || object instanceof ArrayBuffer || object instanceof SharedArrayBuffer) {
} else if (
object instanceof ByteBuffer ||
object instanceof Buffer ||
object instanceof ArrayBuffer ||
object instanceof SharedArrayBuffer
) {
const arrayBuffer = ByteBuffer.wrap(object).toArrayBuffer();
return new Uint8Array(arrayBuffer);
} else if (Array.isArray(object)) {

@ -15,5 +15,5 @@ export {
GroupUtils,
StringUtils,
PromiseUtils,
ProtobufUtils
ProtobufUtils,
};

Loading…
Cancel
Save