mam: Add `MAMResult` hook

This commit is contained in:
JC Brand 2020-04-23 08:56:20 +02:00
parent ad4999384d
commit b44c0c266c
3 changed files with 7 additions and 7 deletions

View File

@ -110,7 +110,7 @@
"newline-per-chained-call": "off",
"no-alert": "off",
"no-array-constructor": "error",
"no-await-in-loop": "error",
"no-await-in-loop": "off",
"no-bitwise": "off",
"no-caller": "error",
"no-console": "off",

View File

@ -6,14 +6,14 @@
*/
import "converse-modal";
import "@converse/headless/utils/muc";
import { BootstrapModal } from "./converse-modal.js";
import { Model } from 'skeletor.js/src/model.js';
import { View } from 'skeletor.js/src/view.js';
import { debounce, head, isString, isUndefined } from "lodash";
import { BootstrapModal } from "./converse-modal.js";
import { render } from "lit-html";
import { __ } from '@converse/headless/i18n';
import { api, converse } from "@converse/headless/converse-core";
import { debounce, head, isString, isUndefined } from "lodash";
import { render } from "lit-html";
import RoomDetailsModal from 'modals/muc-details.js';
import { converse } from "@converse/headless/converse-core";
import log from "@converse/headless/log";
import st from "@converse/headless/utils/stanza";
import tpl_add_chatroom_modal from "templates/add_chatroom_modal.js";
@ -89,7 +89,6 @@ converse.plugins.add('converse-muc-views', {
initialize () {
const { _converse } = this;
const { api } = _converse;
api.promises.add(['roomsPanelRendered']);

View File

@ -98,7 +98,8 @@ converse.plugins.add('converse-mam', {
}, options);
const result = await api.archive.query(query);
/* eslint-disable no-await-in-loop */
api.hook('MAMResult', this, { result, query });
for (const message of result.messages) {
try {
await msg_handler(message);