Start using the message plugin

This is instead of using the stanza directly. To get this to work,
we had to import a couple of other util libraries just so that
they assign their respective utils to Converse's `u` object. This
is probably supposed to happen by itself when the respective
plugins are loaded, but for whatever reason it wasn't happening so
here we are.
This commit is contained in:
Badri Sunderarajan 2022-09-16 18:55:16 +05:30
parent d2f6414980
commit 1c6cdece7f

View file

@ -17,11 +17,21 @@ import "@converse/headless/plugins/smacks/index.js"; // XEP-0198 Stream Mana
import "@converse/headless/plugins/status/index.js";
import "@converse/headless/plugins/vcard/index.js"; // XEP-0054 VCard-temp
// We're just importing these to activate the addon
import {
convertASCII2Emoji,
getShortnameReferences,
getCodePointReferences
} from '@converse/headless/plugins/emoji/utils.js';
import {
appendArrayBuffer,
arrayBufferToBase64,
arrayBufferToHex,
arrayBufferToString,
base64ToArrayBuffer,
hexToArrayBuffer,
stringToArrayBuffer
} from '@converse/headless/utils/arraybuffer.js';
window.converse = converse;
@ -52,12 +62,10 @@ converse.plugins.add('convo', {
})
_converse.api.listen.on('connected', () => {
console.debug("Presence, let's go ;)")
_converse.api.send(converse.env.$pres({}))
alert("Connected! Unfortunately the next screen isn't ready so we'll just wait here :P")
console.debug('Connected successfully ;)')
_converse.api.listen.on('message', (msg) => {
alert(`${msg.attrs.from} says: ${msg.attrs.body}`)
console.debug(`${msg.attrs.from} says: ${msg.attrs.body}`)
})
})