diff --git a/conversejs/custom/plugins/poll/utils.js b/conversejs/custom/plugins/poll/utils.js
index 9a4a3812..f10172b4 100644
--- a/conversejs/custom/plugins/poll/utils.js
+++ b/conversejs/custom/plugins/poll/utils.js
@@ -3,12 +3,12 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { XMLNS_POLL } from './constants.js'
-import { _converse, api } from '../../../src/headless/core.js'
+import { _converse, api } from '../../../src/headless/index.js'
import { __ } from 'i18n'
export function getHeadingButtons (view, buttons) {
const muc = view.model
- if (muc.get('type') !== _converse.CHATROOMS_TYPE) {
+ if (muc.get('type') !== _converse.constants.CHATROOMS_TYPE) {
// only on MUC.
return buttons
}
diff --git a/conversejs/custom/plugins/size/index.js b/conversejs/custom/plugins/size/index.js
index 7732002e..d02ce408 100644
--- a/conversejs/custom/plugins/size/index.js
+++ b/conversejs/custom/plugins/size/index.js
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-only
-import { _converse, converse, api } from '../../../src/headless/core.js'
+import { _converse, converse, api } from '../../../src/headless/index.js'
/**
* This plugin computes the available width of converse-root, and adds classes
diff --git a/conversejs/custom/plugins/tasks/components/muc-task-app-view.js b/conversejs/custom/plugins/tasks/components/muc-task-app-view.js
index 155b75a2..32e3c7ce 100644
--- a/conversejs/custom/plugins/tasks/components/muc-task-app-view.js
+++ b/conversejs/custom/plugins/tasks/components/muc-task-app-view.js
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-only
-import { api } from '@converse/headless/core'
+import { api } from '@converse/headless'
import { CustomElement } from 'shared/components/element.js'
import { tplMUCTaskApp } from '../templates/muc-task-app.js'
diff --git a/conversejs/custom/plugins/tasks/components/muc-task-list-view.js b/conversejs/custom/plugins/tasks/components/muc-task-list-view.js
index 3f97abfd..8688468c 100644
--- a/conversejs/custom/plugins/tasks/components/muc-task-list-view.js
+++ b/conversejs/custom/plugins/tasks/components/muc-task-list-view.js
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { CustomElement } from 'shared/components/element.js'
-import { api } from '@converse/headless/core'
+import { api } from '@converse/headless'
import tplMucTaskList from '../templates/muc-task-list'
import { __ } from 'i18n'
diff --git a/conversejs/custom/plugins/tasks/components/muc-task-lists-view.js b/conversejs/custom/plugins/tasks/components/muc-task-lists-view.js
index c4429827..7c0df41c 100644
--- a/conversejs/custom/plugins/tasks/components/muc-task-lists-view.js
+++ b/conversejs/custom/plugins/tasks/components/muc-task-lists-view.js
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { CustomElement } from 'shared/components/element.js'
-import { api } from '@converse/headless/core'
+import { api } from '@converse/headless'
import tplMucTaskLists from '../templates/muc-task-lists'
import { __ } from 'i18n'
diff --git a/conversejs/custom/plugins/tasks/components/muc-task-view.js b/conversejs/custom/plugins/tasks/components/muc-task-view.js
index 1d02af85..db7bfdda 100644
--- a/conversejs/custom/plugins/tasks/components/muc-task-view.js
+++ b/conversejs/custom/plugins/tasks/components/muc-task-view.js
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { CustomElement } from 'shared/components/element.js'
-import { api } from '@converse/headless/core'
+import { api } from '@converse/headless'
import { tplMucTask } from '../templates/muc-task'
import { __ } from 'i18n'
diff --git a/conversejs/custom/plugins/tasks/index.js b/conversejs/custom/plugins/tasks/index.js
index 50b6afd7..8c7b53fb 100644
--- a/conversejs/custom/plugins/tasks/index.js
+++ b/conversejs/custom/plugins/tasks/index.js
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-only
-import { _converse, converse } from '../../../src/headless/core.js'
+import { _converse, converse } from '../../../src/headless/index.js'
import { ChatRoomTaskLists } from './task-lists.js'
import { ChatRoomTaskList } from './task-list.js'
import { ChatRoomTasks } from './tasks.js'
@@ -18,9 +18,14 @@ converse.plugins.add('livechat-converse-tasks', {
dependencies: ['converse-muc', 'converse-disco', 'converse-pubsub'],
initialize () {
- _converse.ChatRoomTaskLists = ChatRoomTaskLists
- _converse.ChatRoomTaskList = ChatRoomTaskList
- _converse.ChatRoomTasks = ChatRoomTasks
+ Object.assign(
+ _converse.exports,
+ {
+ ChatRoomTaskLists,
+ ChatRoomTaskList,
+ ChatRoomTasks
+ }
+ )
_converse.api.settings.extend({
livechat_task_app_enabled: false,
diff --git a/conversejs/custom/plugins/tasks/modals/pick-task-list.js b/conversejs/custom/plugins/tasks/modals/pick-task-list.js
index 7258bd33..1c5e1701 100644
--- a/conversejs/custom/plugins/tasks/modals/pick-task-list.js
+++ b/conversejs/custom/plugins/tasks/modals/pick-task-list.js
@@ -4,7 +4,7 @@
import BaseModal from 'plugins/modal/modal.js'
import tplPickTaskList from './templates/pick-task-list.js'
-import { api } from '@converse/headless/core'
+import { api } from '@converse/headless'
import { __ } from 'i18n'
export default class PickTaskListModal extends BaseModal {
diff --git a/conversejs/custom/plugins/tasks/task-list.js b/conversejs/custom/plugins/tasks/task-list.js
index e58106de..23a00a0a 100644
--- a/conversejs/custom/plugins/tasks/task-list.js
+++ b/conversejs/custom/plugins/tasks/task-list.js
@@ -7,7 +7,7 @@ import { Model } from '@converse/skeletor/src/model.js'
/**
* A chat room task list.
* @class
- * @namespace _converse.ChatRoomTaskList
+ * @namespace _converse.exports.ChatRoomTaskList
* @memberof _converse
*/
class ChatRoomTaskList extends Model {
diff --git a/conversejs/custom/plugins/tasks/task-lists.js b/conversejs/custom/plugins/tasks/task-lists.js
index d74edb81..17130a73 100644
--- a/conversejs/custom/plugins/tasks/task-lists.js
+++ b/conversejs/custom/plugins/tasks/task-lists.js
@@ -7,9 +7,9 @@ import { ChatRoomTaskList } from './task-list'
import { initStorage } from '@converse/headless/utils/storage.js'
/**
- * A list of {@link _converse.ChatRoomTaskList} instances, representing task lists associated to a MUC.
+ * A list of {@link _converse.exports.ChatRoomTaskList} instances, representing task lists associated to a MUC.
* @class
- * @namespace _converse.ChatRoomTaskLists
+ * @namespace _converse.exports.ChatRoomTaskLists
* @memberOf _converse
*/
class ChatRoomTaskLists extends Collection {
diff --git a/conversejs/custom/plugins/tasks/task.js b/conversejs/custom/plugins/tasks/task.js
index 7d21b947..9bf9c6f6 100644
--- a/conversejs/custom/plugins/tasks/task.js
+++ b/conversejs/custom/plugins/tasks/task.js
@@ -7,7 +7,7 @@ import { Model } from '@converse/skeletor/src/model.js'
/**
* A chat room task.
* @class
- * @namespace _converse.ChatRoomTask
+ * @namespace _converse.exports.ChatRoomTask
* @memberof _converse
*/
class ChatRoomTask extends Model {
diff --git a/conversejs/custom/plugins/tasks/tasks.js b/conversejs/custom/plugins/tasks/tasks.js
index 239a1723..facc16d6 100644
--- a/conversejs/custom/plugins/tasks/tasks.js
+++ b/conversejs/custom/plugins/tasks/tasks.js
@@ -7,9 +7,9 @@ import { ChatRoomTask } from './task'
import { initStorage } from '@converse/headless/utils/storage.js'
/**
- * A list of {@link _converse.ChatRoomTask} instances, representing all tasks associated to a MUC.
+ * A list of {@link _converse.exports.ChatRoomTask} instances, representing all tasks associated to a MUC.
* @class
- * @namespace _converse.ChatRoomTasks
+ * @namespace _converse.exports.ChatRoomTasks
* @memberOf _converse
*/
class ChatRoomTasks extends Collection {
diff --git a/conversejs/custom/plugins/tasks/utils.js b/conversejs/custom/plugins/tasks/utils.js
index 8406412d..52e0162b 100644
--- a/conversejs/custom/plugins/tasks/utils.js
+++ b/conversejs/custom/plugins/tasks/utils.js
@@ -4,12 +4,12 @@
import { XMLNS_TASKLIST, XMLNS_TASK } from './constants.js'
import { PubSubManager } from '../../shared/lib/pubsub-manager.js'
-import { converse, _converse, api } from '../../../src/headless/core.js'
+import { converse, _converse, api } from '../../../src/headless/index.js'
import { __ } from 'i18n'
export function getHeadingButtons (view, buttons) {
const muc = view.model
- if (muc.get('type') !== _converse.CHATROOMS_TYPE) {
+ if (muc.get('type') !== _converse.constants.CHATROOMS_TYPE) {
// only on MUC.
return buttons
}
@@ -74,8 +74,8 @@ function _initChatRoomTaskLists (mucModel) {
return
}
- mucModel.tasklists = new _converse.ChatRoomTaskLists(undefined, { chatroom: mucModel })
- mucModel.tasks = new _converse.ChatRoomTasks(undefined, { chatroom: mucModel })
+ mucModel.tasklists = new _converse.exports.ChatRoomTaskLists(undefined, { chatroom: mucModel })
+ mucModel.tasks = new _converse.exports.ChatRoomTasks(undefined, { chatroom: mucModel })
mucModel.taskManager = new PubSubManager(
mucModel.get('jid'),
@@ -127,7 +127,7 @@ function _destroyChatRoomTaskLists (mucModel) {
}
export function initOrDestroyChatRoomTaskLists (mucModel) {
- if (mucModel.get('type') !== _converse.CHATROOMS_TYPE) {
+ if (mucModel.get('type') !== _converse.constants.CHATROOMS_TYPE) {
// only on MUC.
return _destroyChatRoomTaskLists(mucModel)
}
diff --git a/conversejs/custom/plugins/terms/components/muc-terms.js b/conversejs/custom/plugins/terms/components/muc-terms.js
index ac57d74a..b133e64b 100644
--- a/conversejs/custom/plugins/terms/components/muc-terms.js
+++ b/conversejs/custom/plugins/terms/components/muc-terms.js
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { CustomElement } from 'shared/components/element.js'
-import { api } from '@converse/headless/core'
+import { api } from '@converse/headless'
import { html } from 'lit'
import { __ } from 'i18n'
diff --git a/conversejs/custom/plugins/terms/index.js b/conversejs/custom/plugins/terms/index.js
index 8459cd82..95d25b61 100644
--- a/conversejs/custom/plugins/terms/index.js
+++ b/conversejs/custom/plugins/terms/index.js
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-only
-import { converse, api } from '../../../src/headless/core.js'
+import { converse, api } from '../../../src/headless/index.js'
import './components/muc-terms.js'
const { sizzle } = converse.env
diff --git a/conversejs/custom/shared/components/font-awesome.js b/conversejs/custom/shared/components/font-awesome.js
index 8a93dfef..33b8c1b0 100644
--- a/conversejs/custom/shared/components/font-awesome.js
+++ b/conversejs/custom/shared/components/font-awesome.js
@@ -4,7 +4,7 @@
/* eslint-disable max-len */
import { html } from 'lit'
-import tplIcons from '../../../src/shared/templates/icons.js'
+import tplIcons from '../../../src/shared/components/templates/icons.js'
export default () => {
// Here we are adding some additonal icons to ConverseJS defaults
diff --git a/conversejs/custom/shared/lib/pubsub-manager.js b/conversejs/custom/shared/lib/pubsub-manager.js
index ceabf378..51a4e13b 100644
--- a/conversejs/custom/shared/lib/pubsub-manager.js
+++ b/conversejs/custom/shared/lib/pubsub-manager.js
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-only
-import { converse, _converse, api } from '../../../src/headless/core.js'
+import { converse, _converse, api } from '../../../src/headless/index.js'
const { $build, Strophe, $iq, sizzle } = converse.env
/**
@@ -50,7 +50,7 @@ export class PubSubManager {
async start () {
// FIXME: handle errors. Find a way to display to user that this failed.
- this.stanzaHandler = _converse.connection.addHandler(
+ this.stanzaHandler = api.connection.get().addHandler(
(message) => {
try {
this._handleMessage(message)
@@ -79,7 +79,7 @@ export class PubSubManager {
// Note: no need to unsubscribe from the pubsub node, the backend will do when users leave the room.
if (this.stanzaHandler) {
- _converse.connection.deleteHandler(this.stanzaHandler)
+ api.connection.get().deleteHandler(this.stanzaHandler)
this.stanzaHandler = undefined
}
}
diff --git a/conversejs/custom/shared/modals/livechat-external-login.js b/conversejs/custom/shared/modals/livechat-external-login.js
index b0accf00..edbbfa30 100644
--- a/conversejs/custom/shared/modals/livechat-external-login.js
+++ b/conversejs/custom/shared/modals/livechat-external-login.js
@@ -4,7 +4,7 @@
import { __ } from 'i18n'
import BaseModal from 'plugins/modal/modal.js'
-import { api } from '@converse/headless/core'
+import { api } from '@converse/headless'
import { html } from 'lit'
import 'livechat-external-login-content.js'
diff --git a/conversejs/custom/templates/background_logo.js b/conversejs/custom/templates/background_logo.js
index 585de358..4548f2a5 100644
--- a/conversejs/custom/templates/background_logo.js
+++ b/conversejs/custom/templates/background_logo.js
@@ -5,7 +5,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { html } from 'lit'
-import { api } from '@converse/headless/core.js'
+import { api } from '@converse/headless/index.js'
export default () => html`
diff --git a/conversejs/custom/templates/livechat-external-login-modal.js b/conversejs/custom/templates/livechat-external-login-modal.js
index a8cbca95..52e33027 100644
--- a/conversejs/custom/templates/livechat-external-login-modal.js
+++ b/conversejs/custom/templates/livechat-external-login-modal.js
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-only
-import { _converse, api } from '@converse/headless/core'
+import { _converse, api } from '@converse/headless'
import { __ } from 'i18n'
import { html } from 'lit'
diff --git a/conversejs/custom/templates/muc-bottom-panel.js b/conversejs/custom/templates/muc-bottom-panel.js
index cfac6d2c..37ebc48b 100644
--- a/conversejs/custom/templates/muc-bottom-panel.js
+++ b/conversejs/custom/templates/muc-bottom-panel.js
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { __ } from 'i18n'
-import { _converse, api } from '@converse/headless/core'
+import { _converse, api } from '@converse/headless'
import { html } from 'lit'
import tplMucBottomPanel from '../../src/plugins/muc-views/templates/muc-bottom-panel.js'
import { CustomElement } from 'shared/components/element.js'
@@ -79,7 +79,7 @@ class SlowMode extends CustomElement {
api.elements.define('livechat-slow-mode', SlowMode)
const tplSlowMode = (o) => {
- if (!o.can_edit) { return html`` }
+ if (!o.can_post) { return html`` }
return html``
}
@@ -128,17 +128,9 @@ const tplViewerMode = (o) => {
}
export default (o) => {
- // ConverseJS 10.x does not handle properly the visitor role in unmoderated rooms.
- // See https://github.com/conversejs/converse.js/issues/3428 for more info.
- // So we will do a dirty hack here to fix this case.
- // Note: ConverseJS 11.x has changed the code, and could be fixed more cleanly (or will be fixed if #3428 is fixed).
- if (o.can_edit && o.model.getOwnRole() === 'visitor') {
- o.can_edit = false
- }
-
let mutedAnonymousMessage
if (
- !o.can_edit &&
+ !o.can_post &&
o.model.features?.get?.('x_peertubelivechat_mute_anonymous') &&
_converse.api.settings.get('livechat_specific_is_anonymous') === true
) {
diff --git a/conversejs/custom/templates/muc-chatarea.js b/conversejs/custom/templates/muc-chatarea.js
index 726e8fd5..d709ca56 100644
--- a/conversejs/custom/templates/muc-chatarea.js
+++ b/conversejs/custom/templates/muc-chatarea.js
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0-only
-import { api } from '@converse/headless/core'
+import { api } from '@converse/headless'
import tplMUCChatarea from '../../src/plugins/muc-views/templates/muc-chatarea.js'
import { html } from 'lit'
diff --git a/conversejs/custom/templates/muc-head.js b/conversejs/custom/templates/muc-head.js
index d926ed32..ebd1ef7a 100644
--- a/conversejs/custom/templates/muc-head.js
+++ b/conversejs/custom/templates/muc-head.js
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { html } from 'lit'
-import { api } from '@converse/headless/core'
+import { api } from '@converse/headless'
import { until } from 'lit/directives/until.js'
import { repeat } from 'lit/directives/repeat.js'
import { unsafeHTML } from 'lit/directives/unsafe-html.js'
diff --git a/conversejs/custom/webpack.livechat.js b/conversejs/custom/webpack.livechat.js
index bf6e041c..6825b35b 100644
--- a/conversejs/custom/webpack.livechat.js
+++ b/conversejs/custom/webpack.livechat.js
@@ -44,7 +44,7 @@ module.exports = merge(prod, {
'../../templates/background_logo.js$': path.resolve(__dirname, 'custom/templates/background_logo.js'),
'./templates/muc-chatarea.js': path.resolve('custom/templates/muc-chatarea.js'),
- '../templates/icons.js': path.resolve(__dirname, 'custom/shared/components/font-awesome.js'),
+ './templates/icons.js': path.resolve(__dirname, 'custom/shared/components/font-awesome.js'),
'shared/styles/index.scss$': path.resolve(__dirname, 'custom/shared/styles/livechat.scss'),
diff --git a/conversejs/lib/converse-params.ts b/conversejs/lib/converse-params.ts
index e7ef1c06..43040524 100644
--- a/conversejs/lib/converse-params.ts
+++ b/conversejs/lib/converse-params.ts
@@ -97,6 +97,7 @@ function defaultConverseParams (
pruning_behavior: 'unscrolled',
colorize_username: true,
send_chat_markers: [],
+ reuse_scram_keys: false, // for now we don't use this.
// This is a specific settings, that is used in ConverseJS customization, to force avatars loading in readonly mode.
livechat_load_all_vcards: !!forceReadonly,
diff --git a/conversejs/lib/plugins/livechat-mini-muc-head.ts b/conversejs/lib/plugins/livechat-mini-muc-head.ts
index 82f71484..49815919 100644
--- a/conversejs/lib/plugins/livechat-mini-muc-head.ts
+++ b/conversejs/lib/plugins/livechat-mini-muc-head.ts
@@ -16,7 +16,7 @@ export const livechatMiniMucHeadPlugin = {
})
_converse.api.listen.on('getHeadingButtons', (view: any, buttons: any[]) => {
- if (view.model.get('type') !== _converse.CHATROOMS_TYPE) {
+ if (view.model.get('type') !== _converse.constants.CHATROOMS_TYPE) {
// only on MUC.
return buttons
}
diff --git a/conversejs/lib/plugins/livechat-specific.ts b/conversejs/lib/plugins/livechat-specific.ts
index 6c7fdf43..b50d254e 100644
--- a/conversejs/lib/plugins/livechat-specific.ts
+++ b/conversejs/lib/plugins/livechat-specific.ts
@@ -15,7 +15,7 @@ export const livechatSpecificsPlugin = {
})
_converse.api.listen.on('getHeadingButtons', (view: any, buttons: any[]) => {
- if (view.model.get('type') !== _converse.CHATROOMS_TYPE) {
+ if (view.model.get('type') !== _converse.constants.CHATROOMS_TYPE) {
// only on MUC.
return buttons
}
@@ -53,6 +53,71 @@ export const livechatSpecificsPlugin = {
return buttons
})
+ _converse.api.listen.on('getToolbarButtons', (toolbarEl: any, buttons: any[]) => {
+ // We will replace the toggle occupant button, to change its appearance.
+ // First, we must find it. We search from the end, because usually it is the last one.
+ let toggleOccupantButton: any
+ for (const button of buttons.reverse()) {
+ if (button.strings?.find((s: string) => s.includes('toggle_occupants'))) { // searching the classname
+ console.debug('[livechatSpecificsPlugin] found the toggle occupants button', button)
+ toggleOccupantButton = button
+ break
+ }
+ }
+ if (!toggleOccupantButton) {
+ console.debug('[livechatSpecificsPlugin] Did not found the toggle occupants button')
+ return buttons
+ }
+
+ buttons = buttons.filter(b => b !== toggleOccupantButton)
+ // Replacing by the new button...
+ // Note: we don't need to test conditions, we know the button was here.
+ const i18nHideOccupants = _converse.__('Hide participants')
+ const i18nShowOccupants = _converse.__('Show participants')
+ const html = window.converse.env.html
+ const icon = toolbarEl.hidden_occupants
+ ? html`
+
+
+ `
+ : html`
+
+
+ `
+ buttons.push(html`
+ `
+ )
+ return buttons
+ })
+
+ // Overriding the MUCHeading custom element, to customize the destroyMUC function:
+ const MUCHeading = _converse.api.elements.registry['converse-muc-heading']
+ if (MUCHeading) {
+ class MUCHeadingOverloaded extends MUCHeading {
+ async destroy (ev: Event): Promise {
+ ev.preventDefault()
+ await destroyMUC(_converse, this.model) // here we call a custom version of destroyMUC
+ }
+ }
+ _converse.api.elements.define('converse-muc-heading', MUCHeadingOverloaded)
+ }
+
_converse.api.listen.on('chatRoomViewInitialized', function (this: any, _model: any): void {
// Remove the spinner if present...
document.getElementById('livechat-loading-spinner')?.remove()
@@ -117,7 +182,7 @@ export const livechatSpecificsPlugin = {
},
overrides: {
ChatRoom: {
- getActionInfoMessage: function (this: any, code: string, nick: string, actor: any): any {
+ getActionInfoMessage: function getActionInfoMessage (this: any, code: string, nick: string, actor: any): any {
if (code === '303') {
// When there is numerous anonymous users joining at the same time,
// they can all change their nicknames at the same time, generating a log of action messages.
@@ -130,6 +195,12 @@ export const livechatSpecificsPlugin = {
}
}
return this.__super__.getActionInfoMessage(code, nick, actor)
+ },
+ canPostMessages: function canPostMessages (this: any) {
+ // ConverseJS does not handle properly the visitor role in unmoderated rooms.
+ // See https://github.com/conversejs/converse.js/issues/3428 for more info.
+ // FIXME: if #3428 is fixed, remove this override.
+ return this.isEntered() && this.getOwnRole() !== 'visitor'
}
},
ChatRoomMessage: {
@@ -183,3 +254,26 @@ function getOpenPromise (): any {
)
return promise
}
+
+async function destroyMUC (_converse: any, model: any): Promise {
+ const __ = _converse.__
+ const messages = [__('Are you sure you want to destroy this groupchat?')]
+ // Note: challenge and newjid make no sens for peertube-plugin-livechat,
+ // we remove them comparing to the original function.
+ let fields = [
+ {
+ name: 'reason',
+ label: __('Optional reason for destroying this groupchat'),
+ placeholder: __('Reason'),
+ value: undefined
+ }
+ ]
+ try {
+ fields = await _converse.api.confirm(__('Confirm'), messages, fields)
+ const reason = fields.filter(f => f.name === 'reason').pop()?.value
+ const newjid = undefined
+ return model.sendDestroyIQ(reason, newjid).then(() => model.close())
+ } catch (e) {
+ console.error(e)
+ }
+}
diff --git a/conversejs/lib/plugins/livechat-viewer-mode.ts b/conversejs/lib/plugins/livechat-viewer-mode.ts
index b01fffab..4d889c88 100644
--- a/conversejs/lib/plugins/livechat-viewer-mode.ts
+++ b/conversejs/lib/plugins/livechat-viewer-mode.ts
@@ -17,11 +17,11 @@ export const livechatViewerModePlugin = {
livechat_external_auth_reconnect_mode: undefined
})
- const originalGetDefaultMUCNickname = _converse.getDefaultMUCNickname
+ const originalGetDefaultMUCNickname = _converse.exports.getDefaultMUCNickname
if (!originalGetDefaultMUCNickname) {
console.error('[livechatViewerModePlugin] getDefaultMUCNickname is not initialized.')
} else {
- Object.assign(_converse, {
+ Object.assign(_converse.exports, {
getDefaultMUCNickname: function (this: any): any {
if (!_converse.api.settings.get('livechat_enable_viewer_mode')) {
return originalGetDefaultMUCNickname.apply(this, arguments)