'use strict';
var AppDispatcher = require('dispatchers/app_dispatcher');
/**
* Used to trigger actions on the chat header
* @module actions/ChatHeaderActions
*/
module.exports = {
/**
*
* @param {object} data
* @param {string} data.room JID of current chat
* @param {string} data.type Panel type. Valid values: files, links, roster.
*/
handlePanelSelect: function handlePanelSelect(data) {
AppDispatcher.dispatch('select-panel', {
activePanel: data.type
});
},
/**
* Initiates edit mode for the topic in the chat header
*/
editTopicInChatHeader: function editTopicInChatHeader() {
AppDispatcher.dispatch('edit-topic');
},
/**
* Cancels the inline edit mode for the topic in the chat header
*/
dismissTopicEdit: function dismissTopicEdit() {
AppDispatcher.dispatch('dismiss-topic-edit');
},
/**
* Updates the topic value in the chat header
* @param {string} newTopic New topic
*/
changeTopic: function changeTopic(newTopic) {
AppDispatcher.dispatch('set-topic', newTopic);
},
/**
* Opens the video UI and calls a user
* @param {object} data
* @param {string} data.jid the jid of the user to call
* @param {bool} data.audio_only whether or not this is an audio-only call
*/
startCall: function startCall(data) {
AppDispatcher.dispatch('start-video-call', {
jid: data.jid,
audio_only: data.audio_only,
type: 'call',
service: data.service,
name: data.name || ''
});
}
};