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

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

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

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

@ -8,9 +8,18 @@ import ByteBuffer from 'bytebuffer';
*/ */
export function convertToTS(object: any): any { export function convertToTS(object: any): any {
// No idea why js `ByteBuffer` and ts `ByteBuffer` differ ... // 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()); 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(); const arrayBuffer = ByteBuffer.wrap(object).toArrayBuffer();
return new Uint8Array(arrayBuffer); return new Uint8Array(arrayBuffer);
} else if (Array.isArray(object)) { } else if (Array.isArray(object)) {

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

Loading…
Cancel
Save