feat(external-api): Add send chat message command
This commit is contained in:
parent
7945f14cee
commit
1d45edbb27
|
@ -27,6 +27,7 @@ import {
|
||||||
import { updateSettings } from '../../react/features/base/settings';
|
import { updateSettings } from '../../react/features/base/settings';
|
||||||
import { isToggleCameraEnabled, toggleCamera } from '../../react/features/base/tracks';
|
import { isToggleCameraEnabled, toggleCamera } from '../../react/features/base/tracks';
|
||||||
import {
|
import {
|
||||||
|
sendMessage,
|
||||||
setPrivateMessageRecipient,
|
setPrivateMessageRecipient,
|
||||||
toggleChat
|
toggleChat
|
||||||
} from '../../react/features/chat/actions';
|
} from '../../react/features/chat/actions';
|
||||||
|
@ -241,6 +242,24 @@ function initCommands() {
|
||||||
sendAnalytics(createApiEvent('avatar.url.changed'));
|
sendAnalytics(createApiEvent('avatar.url.changed'));
|
||||||
APP.conference.changeLocalAvatarUrl(avatarUrl);
|
APP.conference.changeLocalAvatarUrl(avatarUrl);
|
||||||
},
|
},
|
||||||
|
'send-chat-message': (message, to, ignorePrivacy = false) => {
|
||||||
|
logger.debug('Send chat message command received');
|
||||||
|
if (to) {
|
||||||
|
const participant = getParticipantById(APP.store.getState(), to);
|
||||||
|
|
||||||
|
if (participant) {
|
||||||
|
APP.store.dispatch(setPrivateMessageRecipient(participant));
|
||||||
|
} else {
|
||||||
|
logger.error(`Participant with id ${to} not found!`);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
APP.store.dispatch(setPrivateMessageRecipient());
|
||||||
|
}
|
||||||
|
|
||||||
|
APP.store.dispatch(sendMessage(message, ignorePrivacy));
|
||||||
|
},
|
||||||
'send-endpoint-text-message': (to, text) => {
|
'send-endpoint-text-message': (to, text) => {
|
||||||
logger.debug('Send endpoint message command received');
|
logger.debug('Send endpoint message command received');
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -41,6 +41,7 @@ const commands = {
|
||||||
password: 'password',
|
password: 'password',
|
||||||
pinParticipant: 'pin-participant',
|
pinParticipant: 'pin-participant',
|
||||||
resizeLargeVideo: 'resize-large-video',
|
resizeLargeVideo: 'resize-large-video',
|
||||||
|
sendChatMessage: 'send-chat-message',
|
||||||
sendEndpointTextMessage: 'send-endpoint-text-message',
|
sendEndpointTextMessage: 'send-endpoint-text-message',
|
||||||
sendTones: 'send-tones',
|
sendTones: 'send-tones',
|
||||||
setLargeVideoParticipant: 'set-large-video-participant',
|
setLargeVideoParticipant: 'set-large-video-participant',
|
||||||
|
|
Loading…
Reference in New Issue