peertube-plugin-livechat/conversejs/custom/plugins/mam-search/index.js

32 lines
1016 B
JavaScript
Raw Normal View History

2024-08-01 14:10:34 +00:00
// SPDX-FileCopyrightText: 2024 John Livingston <https://www.john-livingston.fr/>
//
// SPDX-License-Identifier: AGPL-3.0-only
import { api, converse } from '../../../src/headless/index.js'
2024-08-01 16:58:25 +00:00
import { getMessageActionButtons } from './utils.js'
2024-08-01 14:10:34 +00:00
import mamSearchApi from './api.js'
2024-08-01 16:58:25 +00:00
import './components/muc-mam-search-app-view.js'
import './components/muc-mam-search-occupant-view.js'
2024-08-05 09:44:11 +00:00
import './components/muc-mam-search-message-view.js'
2024-08-01 14:10:34 +00:00
converse.plugins.add('livechat-converse-mam-search', {
dependencies: ['converse-muc', 'converse-muc-views'],
async initialize () {
const _converse = this._converse
Object.assign(api, {
livechat_mam_search: mamSearchApi
})
2024-08-01 16:58:25 +00:00
_converse.api.settings.extend({
livechat_mam_search_app_enabled: false
})
2024-08-01 14:10:34 +00:00
// Adding buttons on message:
_converse.api.listen.on('getMessageActionButtons', getMessageActionButtons)
// FIXME: should we listen to any event (feature/affiliation change?, mam_enabled?) to refresh messageActionButtons?
}
})