Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(external-api) add messageId and replyToMessageId in incoming-message
Subhajit578716ceb0930c9
diff --git a/modules/API/API.js b/modules/API/API.jsindex dc47a4166a..0267ae0d4a 100755--- a/modules/API/API.js+++ b/modules/API/API.js@@ -1489,19 +1489,29 @@ class API {* @returns {void}*/notifyReceivedChatMessage(- { body, from, nick, privateMessage, ts } = {}) {+ { body, from, nick, privateMessage, ts, messageId, replyToMessageId } = {}) {if (APP.conference.isLocalId(from)) {return;}- this._sendEvent({+ const event = {name: 'incoming-message',from,message: body,nick,privateMessage,stamp: ts- });+ };++ if (typeof messageId === 'string' && messageId !== '') {+ event.messageId = messageId;+ }++ if (typeof replyToMessageId === 'string' && replyToMessageId !== '') {+ event.replyToMessageId = replyToMessageId;+ }++ this._sendEvent(event);}/**diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.jsindex ef7da76125..9ca7bf9733 100644--- a/modules/API/external/external_api.js+++ b/modules/API/external/external_api.js@@ -806,7 +806,11 @@ export default class JitsiMeetExternalAPI extends EventEmitter {* {{* 'from': from,//JID of the user that sent the message* 'nick': nick,//the nickname of the user that sent the message- * 'message': txt//the text of the message+ * 'message': txt,//the text of the message+ * 'privateMessage': privateMessage,//whether the message is private+ * 'stamp': stamp,//optional timestamp when available+ * 'messageId': messageId,//optional XMPP message id when available+ * 'replyToMessageId': replyToMessageId//optional XEP-0461 reply target message id when available* }}* {@code outgoingMessage} - receives event notifications about outgoing* messages. The listener will receive object with the following structure:diff --git a/react/features/chat/middleware.ts b/react/features/chat/middleware.tsindex 6767a45a4f..6bd65bf7e9 100644--- a/react/features/chat/middleware.ts+++ b/react/features/chat/middleware.ts@@ -406,7 +406,7 @@ function _addChatMsgListener(conference: IJitsiConference, store: IStore) {JitsiConferenceEvents.MESSAGE_RECEIVED,/* eslint-disable max-params */(participantId: string, message: string, timestamp: number,- displayName: string, isFromVisitor: boolean, messageId: string, source: string) => {+ displayName: string, isFromVisitor: boolean, messageId: string, source: string, replyToId?: string) => {/* eslint-enable max-params */_onConferenceMessageReceived(store, {// in case of messages coming from visitors we can have unknown id@@ -416,6 +416,7 @@ function _addChatMsgListener(conference: IJitsiConference, store: IStore) {displayName,isFromVisitor,messageId,+ replyToMessageId: replyToId,source,privateMessage: false});@@ -441,7 +442,8 @@ function _addChatMsgListener(conference: IJitsiConference, store: IStore) {conference.on(JitsiConferenceEvents.PRIVATE_MESSAGE_RECEIVED,- (participantId: string, message: string, timestamp: number, messageId: string, displayName?: string, isFromVisitor?: boolean) => {+ (participantId: string, message: string, timestamp: number, messageId: string, displayName?: string,+ isFromVisitor?: boolean, replyToId?: string) => {_onConferenceMessageReceived(store, {participantId,message,@@ -449,7 +451,8 @@ function _addChatMsgListener(conference: IJitsiConference, store: IStore) {displayName,messageId,privateMessage: true,- isFromVisitor+ isFromVisitor,+ replyToMessageId: replyToId});});@@ -468,9 +471,9 @@ function _addChatMsgListener(conference: IJitsiConference, store: IStore) {* @returns {void}*/function _onConferenceMessageReceived(store: IStore,- { displayName, isFromVisitor, message, messageId, participantId, privateMessage, timestamp, source }: {+ { displayName, isFromVisitor, message, messageId, participantId, privateMessage, replyToMessageId, timestamp, source }: {displayName?: string; isFromVisitor?: boolean; message: string; messageId?: string;- participantId: string; privateMessage: boolean; source?: string; timestamp: number; }+ participantId: string; privateMessage: boolean; replyToMessageId?: string; source?: string; timestamp: number; }) {const isGif = isGifEnabled(store.getState()) && isGifMessage(message);@@ -490,6 +493,7 @@ function _onConferenceMessageReceived(store: IStore,lobbyChat: false,timestamp,messageId,+ replyToMessageId,source}, true, isGif);}@@ -599,9 +603,10 @@ function getLobbyChatDisplayName(state: IReduxState, participantId: string) {* @returns {void}*/function _handleReceivedMessage({ dispatch, getState }: IStore,- { displayName, isFromVisitor, lobbyChat, message, messageId, participantId, privateMessage, source, timestamp }: {+ { displayName, isFromVisitor, lobbyChat, message, messageId, participantId, privateMessage, replyToMessageId, source, timestamp }: {displayName?: string; isFromVisitor?: boolean; lobbyChat: boolean; message: string;- messageId?: string; participantId: string; privateMessage: boolean; source?: string; timestamp: number; },+ messageId?: string; participantId: string; privateMessage: boolean; replyToMessageId?: string;+ source?: string; timestamp: number; },shouldPlaySound = true,isReaction = false) {@@ -652,6 +657,7 @@ function _handleReceivedMessage({ dispatch, getState }: IStore,recipient: getParticipantDisplayName(state, localParticipant?.id ?? ''),timestamp: millisecondsTimestamp,messageId,+ replyToMessageId,isReaction,isFromVisitor,isFromGuest: source === 'guest'@@ -687,7 +693,9 @@ function _handleReceivedMessage({ dispatch, getState }: IStore,from: participantId,nick: notificationDisplayName,privateMessage,- ts: timestamp+ ts: timestamp,+ messageId: newMessage.messageId,+ replyToMessageId: newMessage.replyToMessageId});}}diff --git a/react/features/chat/reducer.ts b/react/features/chat/reducer.tsindex aa1629d5a0..92be458cbe 100644--- a/react/features/chat/reducer.ts+++ b/react/features/chat/reducer.ts@@ -83,6 +83,7 @@ ReducerRegistry.register<IChatState>('features/chat', (state = DEFAULT_STATE, acprivateMessage: action.privateMessage,lobbyChat: action.lobbyChat,recipient: action.recipient,+ replyToMessageId: action.replyToMessageId,sentToVisitor: Boolean(action.sentToVisitor),timestamp: action.timestamp};diff --git a/react/features/chat/types.ts b/react/features/chat/types.tsindex 1a2b58b131..6e3a74965c 100644--- a/react/features/chat/types.ts+++ b/react/features/chat/types.ts@@ -18,6 +18,10 @@ export interface IMessage {privateMessage: boolean;reactions: Map<string, Set<string>>;recipient: string;+ /**+ * When set, XMPP message id of the message this one replies to (XEP-0461), from lib-jitsi-meet.+ */+ replyToMessageId?: string;sentToVisitor?: boolean;timestamp: number;}