You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-07 23:02:56 +03:00
review: use single payload for ReceivedToDeviceMessage
This commit is contained in:
@@ -87,7 +87,7 @@ import { type IIdentityServerProvider } from "./@types/IIdentityServerProvider.t
|
||||
import { type MatrixScheduler } from "./scheduler.ts";
|
||||
import { type BeaconEvent, type BeaconEventHandlerMap } from "./models/beacon.ts";
|
||||
import { type AuthDict } from "./interactive-auth.ts";
|
||||
import { type IMinimalEvent, type IRoomEvent, type IStateEvent, type IToDeviceEvent } from "./sync-accumulator.ts";
|
||||
import { type IMinimalEvent, type IRoomEvent, type IStateEvent, type ReceivedToDeviceMessage } from "./sync-accumulator.ts";
|
||||
import type { EventTimelineSet } from "./models/event-timeline-set.ts";
|
||||
import * as ContentHelpers from "./content-helpers.ts";
|
||||
import {
|
||||
@@ -220,7 +220,6 @@ import {
|
||||
CryptoEvent,
|
||||
type CryptoEventHandlerMap,
|
||||
type CryptoCallbacks,
|
||||
type OlmEncryptionInfo,
|
||||
} from "./crypto-api/index.ts";
|
||||
import {
|
||||
type SecretStorageKeyDescription,
|
||||
@@ -1093,18 +1092,18 @@ export type ClientEventHandlerMap = {
|
||||
[ClientEvent.ToDeviceEvent]: (event: MatrixEvent) => void;
|
||||
/**
|
||||
* Fires whenever the SDK receives a new to-device message.
|
||||
* @param message - The to-device message which caused this event to fire.
|
||||
* @param encryptionInfo - The encryptionInfo for this message, null if sent in clear.
|
||||
* @param payload - The message and encryptionInfo for this message (See {@link ReceivedToDeviceMessage}) which caused this event to fire.
|
||||
* @example
|
||||
* ```
|
||||
* matrixClient.on("receivedToDeviceMessage", function(message, encryptionInfo){
|
||||
* matrixClient.on("receivedToDeviceMessage", function(payload){
|
||||
* const { message, encryptionInfo } = payload;
|
||||
* var claimed_sender = encryptionInfo ? encryptionInfo.sender : message.sender;
|
||||
* var isVerified = encryptionInfo ? encryptionInfo.verified : false;
|
||||
* var type = message.type;
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
[ClientEvent.ReceivedToDeviceMessage]: (message: IToDeviceEvent, encryptionInfo: OlmEncryptionInfo | null) => void;
|
||||
[ClientEvent.ReceivedToDeviceMessage]: (payload: ReceivedToDeviceMessage) => void;
|
||||
/**
|
||||
* Fires if a to-device event is received that cannot be decrypted.
|
||||
* Encrypted to-device events will (generally) use plain Olm encryption,
|
||||
|
@@ -1976,6 +1976,6 @@ export function processToDeviceMessages(toDeviceMessages: ReceivedToDeviceMessag
|
||||
client.emit(ClientEvent.ToDeviceEvent, deprecatedCompatibilityEvent);
|
||||
}
|
||||
|
||||
client.emit(ClientEvent.ReceivedToDeviceMessage, processedEvent.message, processedEvent.encryptionInfo);
|
||||
client.emit(ClientEvent.ReceivedToDeviceMessage, processedEvent);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user