Better handling of calling messages
This commit is contained in:
parent
a2f1b469ea
commit
b26f60d2fc
2 changed files with 47 additions and 1 deletions
|
@ -66,7 +66,7 @@ import {
|
||||||
findBestMatchingCameraId,
|
findBestMatchingCameraId,
|
||||||
} from '../calling/findBestMatchingDevice';
|
} from '../calling/findBestMatchingDevice';
|
||||||
import type { LocalizerType } from '../types/Util';
|
import type { LocalizerType } from '../types/Util';
|
||||||
import { UUID } from '../types/UUID';
|
import { UUID, UUIDKind } from '../types/UUID';
|
||||||
import type { ConversationModel } from '../models/conversations';
|
import type { ConversationModel } from '../models/conversations';
|
||||||
import * as Bytes from '../Bytes';
|
import * as Bytes from '../Bytes';
|
||||||
import { uuidToBytes, bytesToUuid } from '../Crypto';
|
import { uuidToBytes, bytesToUuid } from '../Crypto';
|
||||||
|
@ -1720,6 +1720,33 @@ export class CallingClass {
|
||||||
log.error('handleGroupCallRingUpdate(): could not find conversation');
|
log.error('handleGroupCallRingUpdate(): could not find conversation');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const logId = `handleGroupCallRingUpdate(${conversation.idForLogging()})`;
|
||||||
|
if (conversation.isBlocked()) {
|
||||||
|
log.warn(`${logId}: is blocked`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ourACI = window.textsecure.storage.user.getCheckedUuid(UUIDKind.ACI);
|
||||||
|
|
||||||
|
if (conversation.get('left') || !conversation.hasMember(ourACI)) {
|
||||||
|
log.warn(`${logId}: we left the group`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!conversation.hasMember(new UUID(ringerUuid))) {
|
||||||
|
log.warn(`${logId}: they left the group`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
conversation.get('announcementsOnly') &&
|
||||||
|
!conversation.isAdmin(new UUID(ringerUuid))
|
||||||
|
) {
|
||||||
|
log.warn(`${logId}: non-admin update to announcement-only group`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const conversationId = conversation.id;
|
const conversationId = conversation.id;
|
||||||
|
|
||||||
let shouldRing = false;
|
let shouldRing = false;
|
||||||
|
@ -1812,6 +1839,13 @@ export class CallingClass {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (conversation.isBlocked()) {
|
||||||
|
log.warn(
|
||||||
|
`handleIncomingCall(): ${conversation.idForLogging()} is blocked`
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// The peer must be 'trusted' before accepting a call from them.
|
// The peer must be 'trusted' before accepting a call from them.
|
||||||
// This is mostly the safety number check, unverified meaning that they were
|
// This is mostly the safety number check, unverified meaning that they were
|
||||||
|
|
|
@ -2529,6 +2529,18 @@ export default class MessageReceiver
|
||||||
logUnexpectedUrgentValue(envelope, 'callingMessage');
|
logUnexpectedUrgentValue(envelope, 'callingMessage');
|
||||||
|
|
||||||
this.removeFromCache(envelope);
|
this.removeFromCache(envelope);
|
||||||
|
|
||||||
|
if (
|
||||||
|
(envelope.source && this.isBlocked(envelope.source)) ||
|
||||||
|
(envelope.sourceUuid && this.isUuidBlocked(envelope.sourceUuid))
|
||||||
|
) {
|
||||||
|
const logId = getEnvelopeId(envelope);
|
||||||
|
|
||||||
|
log.info(`${logId}: Dropping calling message from blocked sender`);
|
||||||
|
this.removeFromCache(envelope);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await window.Signal.Services.calling.handleCallingMessage(
|
await window.Signal.Services.calling.handleCallingMessage(
|
||||||
envelope,
|
envelope,
|
||||||
callingMessage
|
callingMessage
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue