diff --git a/src/@types/event.ts b/src/@types/event.ts index fd906266e..1416a0b71 100644 --- a/src/@types/event.ts +++ b/src/@types/event.ts @@ -53,6 +53,7 @@ import { } from "../webrtc/callEventTypes.ts"; import { type IRTCNotificationContent, + type IRTCDeclineContent, type EncryptionKeysEventContent, type ICallNotifyContent, } from "../matrixrtc/types.ts"; @@ -152,6 +153,7 @@ export enum EventType { // MatrixRTC events CallNotify = "org.matrix.msc4075.call.notify", RTCNotification = "org.matrix.msc4075.rtc.notification", + RTCDecline = "org.matrix.msc4310.rtc.decline", } export enum RelationType { @@ -332,6 +334,7 @@ export interface TimelineEvents { [EventType.CallEncryptionKeysPrefix]: EncryptionKeysEventContent; [EventType.CallNotify]: ICallNotifyContent; [EventType.RTCNotification]: IRTCNotificationContent; + [EventType.RTCDecline]: IRTCDeclineContent; [M_BEACON.name]: MBeaconEventContent; [M_POLL_START.name]: PollStartEventContent; [M_POLL_END.name]: PollEndEventContent; diff --git a/src/client.ts b/src/client.ts index f30b9ca0b..07cf8547c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -3589,6 +3589,12 @@ export class MatrixClient extends TypedEventEmitter { + return this.sendEvent(roomId, EventType.RTCDecline, { + "m.relates_to": { event_id: notificationEventId, rel_type: RelationType.Reference }, + }); + } + /** * Get a preview of the given URL as of (roughly) the given point in time, * described as an object with OpenGraph keys and associated values. diff --git a/src/matrixrtc/types.ts b/src/matrixrtc/types.ts index 73c5a0170..1f7bbe3a6 100644 --- a/src/matrixrtc/types.ts +++ b/src/matrixrtc/types.ts @@ -104,6 +104,12 @@ export interface IRTCNotificationContent extends RelationEvent { "lifetime": number; } +/** + * MSC4310 decline event content for `org.matrix.msc4310.rtc.decline`. + * Sent as a standard m.reference relation to an `org.matrix.msc4075.rtc.notification` event. + */ +export interface IRTCDeclineContent extends RelationEvent {} + export enum Status { Disconnected = "Disconnected", Connecting = "Connecting",