Commit 1a3526f5 authored by JC Brand's avatar JC Brand

Update `openAndEnterChatRoom` to take JID

parent da1d8764
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'tom');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
['dick', 'harry'].forEach((nick) => { ['dick', 'harry'].forEach((nick) => {
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
expect(view.model.occupants.length).toBe(1); expect(view.model.occupants.length).toBe(1);
let presence = $pres({ let presence = $pres({
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
expect(view.model.occupants.length).toBe(1); expect(view.model.occupants.length).toBe(1);
const presence = $pres({ const presence = $pres({
......
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async (done, _converse) => { async (done, _converse) => {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
test_utils.waitUntilDiscoConfirmed( test_utils.waitUntilDiscoConfirmed(
_converse, _converse.domain, _converse, _converse.domain,
[{'category': 'server', 'type':'IM'}], [{'category': 'server', 'type':'IM'}],
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.domain, [], [], ['upload.montague.lit'], 'items'); await test_utils.waitUntilDiscoConfirmed(_converse, _converse.domain, [], [], ['upload.montague.lit'], 'items');
await test_utils.waitUntilDiscoConfirmed(_converse, 'upload.montague.lit', [], [Strophe.NS.HTTPUPLOAD], []); await test_utils.waitUntilDiscoConfirmed(_converse, 'upload.montague.lit', [], [Strophe.NS.HTTPUPLOAD], []);
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
await test_utils.waitUntil(() => _converse.chatboxviews.get('lounge@montague.lit').el.querySelector('.upload-file')); await test_utils.waitUntil(() => _converse.chatboxviews.get('lounge@montague.lit').el.querySelector('.upload-file'));
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
expect(view.el.querySelector('.chat-toolbar .upload-file')).not.toBe(null); expect(view.el.querySelector('.chat-toolbar .upload-file')).not.toBe(null);
...@@ -365,7 +365,7 @@ ...@@ -365,7 +365,7 @@
await test_utils.waitUntilDiscoConfirmed(_converse, _converse.domain, [], [], ['upload.montague.tld'], 'items'); await test_utils.waitUntilDiscoConfirmed(_converse, _converse.domain, [], [], ['upload.montague.tld'], 'items');
await test_utils.waitUntilDiscoConfirmed(_converse, 'upload.montague.tld', [], [Strophe.NS.HTTPUPLOAD], []); await test_utils.waitUntilDiscoConfirmed(_converse, 'upload.montague.tld', [], [Strophe.NS.HTTPUPLOAD], []);
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
// Wait until MAM query has been sent out // Wait until MAM query has been sent out
const sent_stanzas = _converse.connection.sent_stanzas; const sent_stanzas = _converse.connection.sent_stanzas;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
null, ['discoInitialized'], {}, null, ['discoInitialized'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'trek-radio', 'conference.lightwitch.org', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'trek-radio@conference.lightwitch.org', 'romeo');
const view = _converse.chatboxviews.get('trek-radio@conference.lightwitch.org'); const view = _converse.chatboxviews.get('trek-radio@conference.lightwitch.org');
let stanza = u.toStanza( let stanza = u.toStanza(
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
null, ['discoInitialized'], {}, null, ['discoInitialized'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'trek-radio', 'conference.lightwitch.org', 'jcbrand'); await test_utils.openAndEnterChatRoom(_converse, 'trek-radio@conference.lightwitch.org', 'jcbrand');
const view = _converse.chatboxviews.get('trek-radio@conference.lightwitch.org'); const view = _converse.chatboxviews.get('trek-radio@conference.lightwitch.org');
let stanza = u.toStanza( let stanza = u.toStanza(
`<message xmlns="jabber:client" to="jcbrand@lightwitch.org/converse.js-73057452" type="groupchat" from="trek-radio@conference.lightwitch.org/comndrdukath#0805 (STO)"> `<message xmlns="jabber:client" to="jcbrand@lightwitch.org/converse.js-73057452" type="groupchat" from="trek-radio@conference.lightwitch.org/comndrdukath#0805 (STO)">
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
null, ['discoInitialized'], {}, null, ['discoInitialized'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'discuss', 'conference.conversejs.org', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'discuss@conference.conversejs.org', 'romeo');
const view = _converse.chatboxviews.get('discuss@conference.conversejs.org'); const view = _converse.chatboxviews.get('discuss@conference.conversejs.org');
let stanza = u.toStanza( let stanza = u.toStanza(
`<message xmlns="jabber:client" to="romeo@montague.lit/orchard" from="discuss@conference.conversejs.org"> `<message xmlns="jabber:client" to="romeo@montague.lit/orchard" from="discuss@conference.conversejs.org">
......
...@@ -2244,14 +2244,14 @@ ...@@ -2244,14 +2244,14 @@
<message xmlns="jabber:client" to="${contact_jid}" type="chat" from="${_converse.bare_jid}/other-resource"> <message xmlns="jabber:client" to="${contact_jid}" type="chat" from="${_converse.bare_jid}/other-resource">
<received xmlns="urn:xmpp:chat-markers:0" id="2e972ea0-0050-44b7-a830-f6638a2595b3"/> <received xmlns="urn:xmpp:chat-markers:0" id="2e972ea0-0050-44b7-a830-f6638a2595b3"/>
<store xmlns="urn:xmpp:hints"/> <store xmlns="urn:xmpp:hints"/>
<stanza-id xmlns="urn:xmpp:sid:0" id="F4TC6CvHwzqRbeHb" by="jc@opkode.com"/> <stanza-id xmlns="urn:xmpp:sid:0" id="F4TC6CvHwzqRbeHb" by="${_converse.bare_jid}"/>
</message> </message>
</forwarded> </forwarded>
</sent> </sent>
</message>`); </message>`);
spyOn(_converse.api, "trigger").and.callThrough(); spyOn(_converse.api, "trigger").and.callThrough();
_converse.connection._dataRecv(test_utils.createRequest(stanza)); _converse.connection._dataRecv(test_utils.createRequest(stanza));
await test_utils.waitUntil(() => _converse.api.trigger.calls.count() === 1); await test_utils.waitUntil(() => _converse.api.trigger.calls.count(), 500);
expect(view.el.querySelectorAll('.chat-msg').length).toBe(1); expect(view.el.querySelectorAll('.chat-msg').length).toBe(1);
expect(view.model.messages.length).toBe(1); expect(view.model.messages.length).toBe(1);
done(); done();
...@@ -2266,8 +2266,9 @@ ...@@ -2266,8 +2266,9 @@
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {}, null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
const view = _converse.api.chatviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
if (!view.el.querySelectorAll('.chat-area').length) { view.renderChatArea(); } if (!view.el.querySelectorAll('.chat-area').length) { view.renderChatArea(); }
const message = 'romeo: Your attention is required'; const message = 'romeo: Your attention is required';
const nick = mock.chatroom_names[0], const nick = mock.chatroom_names[0],
...@@ -2288,8 +2289,9 @@ ...@@ -2288,8 +2289,9 @@
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {}, null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
const view = _converse.chatboxviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
if (!view.el.querySelectorAll('.chat-area').length) { view.renderChatArea(); } if (!view.el.querySelectorAll('.chat-area').length) { view.renderChatArea(); }
const id = u.getUniqueId(); const id = u.getUniqueId();
let msg = $msg({ let msg = $msg({
...@@ -2319,8 +2321,9 @@ ...@@ -2319,8 +2321,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'room', 'muc.example.com', 'romeo'); const muc_jid = 'room@muc.example.com';
const view = _converse.chatboxviews.get('room@muc.example.com'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
spyOn(view.model, 'findDuplicateFromStanzaID').and.callThrough(); spyOn(view.model, 'findDuplicateFromStanzaID').and.callThrough();
let stanza = u.toStanza(` let stanza = u.toStanza(`
<message xmlns="jabber:client" <message xmlns="jabber:client"
...@@ -2364,8 +2367,9 @@ ...@@ -2364,8 +2367,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
const view = _converse.api.chatviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
let msg = $msg({ let msg = $msg({
from: 'lounge@montague.lit/romeo', from: 'lounge@montague.lit/romeo',
id: (new Date()).getTime(), id: (new Date()).getTime(),
...@@ -2435,8 +2439,9 @@ ...@@ -2435,8 +2439,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
const view = _converse.api.chatviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
const msg = $msg({ const msg = $msg({
from: 'lounge@montague.lit/romeo', from: 'lounge@montague.lit/romeo',
id: (new Date()).getTime(), id: (new Date()).getTime(),
...@@ -2454,10 +2459,9 @@ ...@@ -2454,10 +2459,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
const jid = 'lounge@montague.lit'; await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const room = _converse.api.rooms.get(jid); const view = _converse.api.chatviews.get(muc_jid);
const view = _converse.api.chatviews.get(jid);
const stanza = $pres({ const stanza = $pres({
to: 'romeo@montague.lit/_converse.js-29092160', to: 'romeo@montague.lit/_converse.js-29092160',
from: 'coven@chat.shakespeare.lit/newguy' from: 'coven@chat.shakespeare.lit/newguy'
...@@ -2522,10 +2526,9 @@ ...@@ -2522,10 +2526,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
const room_jid = 'lounge@montague.lit'; await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const room = _converse.api.rooms.get(room_jid); const view = _converse.api.chatviews.get(muc_jid);
const view = _converse.api.chatviews.get(room_jid);
const textarea = view.el.querySelector('textarea.chat-textarea'); const textarea = view.el.querySelector('textarea.chat-textarea');
expect(textarea.value).toBe(''); expect(textarea.value).toBe('');
view.onKeyDown({ view.onKeyDown({
...@@ -2593,7 +2596,7 @@ ...@@ -2593,7 +2596,7 @@
// Check that messages from other users are skipped // Check that messages from other users are skipped
await view.model.onMessage($msg({ await view.model.onMessage($msg({
'from': room_jid+'/someone-else', 'from': muc_jid+'/someone-else',
'id': (new Date()).getTime(), 'id': (new Date()).getTime(),
'to': 'romeo@montague.lit', 'to': 'romeo@montague.lit',
'type': 'groupchat' 'type': 'groupchat'
...@@ -2629,8 +2632,9 @@ ...@@ -2629,8 +2632,9 @@
async function (done, _converse) { async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current'); await test_utils.waitForRoster(_converse, 'current');
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
const view = _converse.chatboxviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
const textarea = view.el.querySelector('textarea.chat-textarea'); const textarea = view.el.querySelector('textarea.chat-textarea');
textarea.value = 'But soft, what light through yonder airlock breaks?'; textarea.value = 'But soft, what light through yonder airlock breaks?';
view.onKeyDown({ view.onKeyDown({
...@@ -2670,8 +2674,9 @@ ...@@ -2670,8 +2674,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'room', 'muc.example.com', 'romeo'); const muc_jid = 'room@muc.example.com';
const view = _converse.chatboxviews.get('room@muc.example.com'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
view.model.sendMessage('hello world'); view.model.sendMessage('hello world');
await test_utils.waitUntil(() => _converse.api.chats.get().length); await test_utils.waitUntil(() => _converse.api.chats.get().length);
...@@ -2706,8 +2711,9 @@ ...@@ -2706,8 +2711,9 @@
async function (done, _converse) { async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current'); await test_utils.waitForRoster(_converse, 'current');
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
const view = _converse.chatboxviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
const textarea = view.el.querySelector('textarea.chat-textarea'); const textarea = view.el.querySelector('textarea.chat-textarea');
textarea.value = 'But soft, what light through yonder airlock breaks?'; textarea.value = 'But soft, what light through yonder airlock breaks?';
view.onKeyDown({ view.onKeyDown({
...@@ -2741,8 +2747,9 @@ ...@@ -2741,8 +2747,9 @@
async function (done, _converse) { async function (done, _converse) {
await test_utils.waitForRoster(_converse, 'current'); await test_utils.waitForRoster(_converse, 'current');
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
const view = _converse.chatboxviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
const textarea = view.el.querySelector('textarea.chat-textarea'); const textarea = view.el.querySelector('textarea.chat-textarea');
textarea.value = 'But soft, what light through yonder airlock breaks?'; textarea.value = 'But soft, what light through yonder airlock breaks?';
view.onKeyDown({ view.onKeyDown({
...@@ -2808,8 +2815,9 @@ ...@@ -2808,8 +2815,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom'); const muc_jid = 'lounge@montague.lit';
const view = _converse.api.chatviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'tom');
const view = _converse.api.chatviews.get(muc_jid);
['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh'].forEach((nick) => { ['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh'].forEach((nick) => {
_converse.connection._dataRecv(test_utils.createRequest( _converse.connection._dataRecv(test_utils.createRequest(
$pres({ $pres({
...@@ -2853,8 +2861,9 @@ ...@@ -2853,8 +2861,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom'); const muc_jid = 'lounge@montague.lit';
const view = _converse.api.chatviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'tom');
const view = _converse.api.chatviews.get(muc_jid);
['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh', 'Link Mauve'].forEach((nick) => { ['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh', 'Link Mauve'].forEach((nick) => {
_converse.connection._dataRecv(test_utils.createRequest( _converse.connection._dataRecv(test_utils.createRequest(
$pres({ $pres({
...@@ -2934,8 +2943,9 @@ ...@@ -2934,8 +2943,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom'); const muc_jid = 'lounge@montague.lit';
const view = _converse.api.chatviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'tom');
const view = _converse.api.chatviews.get(muc_jid);
['NotAnAdress', 'darnuria'].forEach((nick) => { ['NotAnAdress', 'darnuria'].forEach((nick) => {
_converse.connection._dataRecv(test_utils.createRequest( _converse.connection._dataRecv(test_utils.createRequest(
$pres({ $pres({
...@@ -2968,9 +2978,9 @@ ...@@ -2968,9 +2978,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom'); const muc_jid = 'lounge@montague.lit';
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'tom');
const view = _converse.api.chatviews.get('lounge@montague.lit'); const view = _converse.api.chatviews.get(muc_jid);
['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh'].forEach((nick) => { ['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh'].forEach((nick) => {
_converse.connection._dataRecv(test_utils.createRequest( _converse.connection._dataRecv(test_utils.createRequest(
$pres({ $pres({
...@@ -3045,8 +3055,9 @@ ...@@ -3045,8 +3055,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'tom'); const muc_jid = 'lounge@montague.lit';
const view = _converse.api.chatviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh'].forEach((nick) => { ['z3r0', 'mr.robot', 'gibson', 'sw0rdf1sh'].forEach((nick) => {
_converse.connection._dataRecv(test_utils.createRequest( _converse.connection._dataRecv(test_utils.createRequest(
$pres({ $pres({
......
...@@ -153,30 +153,26 @@ ...@@ -153,30 +153,26 @@
it("shows the number messages received to minimized groupchats", it("shows the number messages received to minimized groupchats",
mock.initConverse( mock.initConverse(
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
function (done, _converse) { async function (done, _converse) {
const room_jid = 'kitchen@conference.shakespeare.lit';
test_utils.openAndEnterChatRoom(
_converse, 'kitchen', 'conference.shakespeare.lit', 'fires').then(function () {
var view = _converse.chatboxviews.get(room_jid);
view.model.set({'minimized': true});
var contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit'; const muc_jid = 'kitchen@conference.shakespeare.lit';
var message = 'fires: Your attention is required'; await test_utils.openAndEnterChatRoom(_converse, 'kitchen@conference.shakespeare.lit', 'fires');
var nick = mock.chatroom_names[0], const view = _converse.chatboxviews.get(muc_jid);
msg = $msg({ view.model.set({'minimized': true});
from: room_jid+'/'+nick, const contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit';
id: (new Date()).getTime(), const message = 'fires: Your attention is required';
to: 'romeo@montague.lit', const nick = mock.chatroom_names[0];
type: 'groupchat' const msg = $msg({
}).c('body').t(message).tree(); from: muc_jid+'/'+nick,
view.model.onMessage(msg); id: (new Date()).getTime(),
return test_utils.waitUntil(() => view.model.messages.length); to: 'romeo@montague.lit',
}).then(() => { type: 'groupchat'
expect(u.isVisible(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count'))).toBeTruthy(); }).c('body').t(message).tree();
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe('1'); view.model.onMessage(msg);
done(); await test_utils.waitUntil(() => view.model.messages.length);
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL)) expect(u.isVisible(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count'))).toBeTruthy();
expect(_converse.minimized_chats.toggleview.el.querySelector('.unread-message-count').textContent).toBe('1');
done();
})); }));
}); });
})); }));
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
await test_utils.openAndEnterChatRoom(_converse, 'leisure', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'leisure@montague.lit', 'romeo');
await test_utils.openAndEnterChatRoom(_converse, 'news', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'news@montague.lit', 'romeo');
expect(u.isVisible(_converse.chatboxviews.get('lounge@montague.lit').el)).toBeTruthy(); expect(u.isVisible(_converse.chatboxviews.get('lounge@montague.lit').el)).toBeTruthy();
expect(u.isVisible(_converse.chatboxviews.get('leisure@montague.lit').el)).toBeTruthy(); expect(u.isVisible(_converse.chatboxviews.get('leisure@montague.lit').el)).toBeTruthy();
expect(u.isVisible(_converse.chatboxviews.get('news@montague.lit').el)).toBeTruthy(); expect(u.isVisible(_converse.chatboxviews.get('news@montague.lit').el)).toBeTruthy();
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
expect(_converse.chatboxviews.get('lounge@montague.lit')).toBeUndefined(); expect(_converse.chatboxviews.get('lounge@montague.lit')).toBeUndefined();
expect(_converse.chatboxviews.get('leisure@montague.lit')).toBeUndefined(); expect(_converse.chatboxviews.get('leisure@montague.lit')).toBeUndefined();
expect(_converse.chatboxviews.get('news@montague.lit')).toBeUndefined(); expect(_converse.chatboxviews.get('news@montague.lit')).toBeUndefined();
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
await test_utils.openAndEnterChatRoom(_converse, 'leisure', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'leisure@montague.lit', 'romeo');
expect(u.isVisible(_converse.chatboxviews.get('lounge@montague.lit').el)).toBeTruthy(); expect(u.isVisible(_converse.chatboxviews.get('lounge@montague.lit').el)).toBeTruthy();
expect(u.isVisible(_converse.chatboxviews.get('leisure@montague.lit').el)).toBeTruthy(); expect(u.isVisible(_converse.chatboxviews.get('leisure@montague.lit').el)).toBeTruthy();
_converse.api.roomviews.close(); _converse.api.roomviews.close();
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
test_utils.createContacts(_converse, 'current'); test_utils.createContacts(_converse, 'current');
await test_utils.waitUntil(() => _converse.rosterview.el.querySelectorAll('.roster-group .group-toggle').length, 300); await test_utils.waitUntil(() => _converse.rosterview.el.querySelectorAll('.roster-group .group-toggle').length, 300);
await test_utils.openAndEnterChatRoom(_converse, 'chillout', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'chillout@montague.lit', 'romeo');
let jid = 'chillout@montague.lit'; let jid = 'chillout@montague.lit';
let room = _converse.api.rooms.get(jid); let room = _converse.api.rooms.get(jid);
expect(room instanceof Object).toBeTruthy(); expect(room instanceof Object).toBeTruthy();
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
chatroomview.close(); chatroomview.close();
// Test with mixed case // Test with mixed case
await test_utils.openAndEnterChatRoom(_converse, 'Leisure', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'Leisure@montague.lit', 'romeo');
jid = 'Leisure@montague.lit'; jid = 'Leisure@montague.lit';
room = _converse.api.rooms.get(jid); room = _converse.api.rooms.get(jid);
expect(room instanceof Object).toBeTruthy(); expect(room instanceof Object).toBeTruthy();
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
const IQ_stanzas = _converse.connection.IQ_stanzas; const IQ_stanzas = _converse.connection.IQ_stanzas;
const sendIQ = _converse.connection.sendIQ; const sendIQ = _converse.connection.sendIQ;
const room_jid = 'lounge@montague.lit'; const muc_jid = 'lounge@montague.lit';
let sent_IQ, IQ_id; let sent_IQ, IQ_id;
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) { spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
if (iq.nodeTree.getAttribute('to') === 'lounge@montague.lit') { if (iq.nodeTree.getAttribute('to') === 'lounge@montague.lit') {
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
let stanza = await test_utils.waitUntil(() => _.filter( let stanza = await test_utils.waitUntil(() => _.filter(
IQ_stanzas, IQ_stanzas,
iq => iq.querySelector( iq => iq.querySelector(
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]` `iq[to="${muc_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
)).pop()); )).pop());
// We pretend this is a new room, so no disco info is returned. // We pretend this is a new room, so no disco info is returned.
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
*/ */
stanza = await test_utils.waitUntil(() => _.filter( stanza = await test_utils.waitUntil(() => _.filter(
IQ_stanzas, IQ_stanzas,
s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s).length s => sizzle(`iq[to="${muc_jid}"] query[node="x-roomuser-item"]`, s).length
).pop() ).pop()
); );
expect(Strophe.serialize(stanza)).toBe( expect(Strophe.serialize(stanza)).toBe(
...@@ -400,7 +400,7 @@ ...@@ -400,7 +400,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.waitUntil(() => test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo')); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
const message = 'Hello world', const message = 'Hello world',
nick = mock.chatroom_names[0], nick = mock.chatroom_names[0],
...@@ -428,7 +428,7 @@ ...@@ -428,7 +428,7 @@
async function (done, _converse) { async function (done, _converse) {
test_utils.createContacts(_converse, 'current'); test_utils.createContacts(_converse, 'current');
await test_utils.waitUntil(() => test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo')); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
if (!view.el.querySelectorAll('.chat-area').length) { if (!view.el.querySelectorAll('.chat-area').length) {
view.renderChatArea(); view.renderChatArea();
...@@ -770,7 +770,7 @@ ...@@ -770,7 +770,7 @@
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {}, null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo') await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo')
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit'); const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
const chat_content = view.el.querySelector('.chat-content'); const chat_content = view.el.querySelector('.chat-content');
...@@ -922,7 +922,7 @@ ...@@ -922,7 +922,7 @@
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_show_join_leave_status': false}, null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'muc_show_join_leave_status': false},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, "coven", 'chat.shakespeare.lit', 'some1'); await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'some1');
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit'); const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
const chat_content = view.el.querySelector('.chat-content'); const chat_content = view.el.querySelector('.chat-content');
expect(sizzle('div.chat-info', chat_content).pop().textContent).toBe('some1 has entered the groupchat'); expect(sizzle('div.chat-info', chat_content).pop().textContent).toBe('some1 has entered the groupchat');
...@@ -999,7 +999,7 @@ ...@@ -999,7 +999,7 @@
// See https://github.com/conversejs/converse.js/issues/1259 // See https://github.com/conversejs/converse.js/issues/1259
await test_utils.openAndEnterChatRoom(_converse, 'conversations', 'conference.siacs.eu', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'conversations@conference.siacs.eu', 'romeo');
const presence = $pres({ const presence = $pres({
to: 'romeo@montague.lit/orchard', to: 'romeo@montague.lit/orchard',
...@@ -1059,7 +1059,7 @@ ...@@ -1059,7 +1059,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo');
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit'); const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
const chat_content = view.el.querySelector('.chat-content'); const chat_content = view.el.querySelector('.chat-content');
let indicator = chat_content.querySelector('.date-separator'); let indicator = chat_content.querySelector('.date-separator');
...@@ -1224,7 +1224,7 @@ ...@@ -1224,7 +1224,7 @@
await test_utils.waitUntilDiscoConfirmed(_converse, 'montague.lit', [], ['vcard-temp']); await test_utils.waitUntilDiscoConfirmed(_converse, 'montague.lit', [], ['vcard-temp']);
await test_utils.waitUntil(() => _converse.xmppstatus.vcard.get('fullname')); await test_utils.waitUntil(() => _converse.xmppstatus.vcard.get('fullname'));
test_utils.createContacts(_converse, 'current'); test_utils.createContacts(_converse, 'current');
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
if (!view.el.querySelectorAll('.chat-area').length) { if (!view.el.querySelectorAll('.chat-area').length) {
view.renderChatArea(); view.renderChatArea();
...@@ -1481,7 +1481,7 @@ ...@@ -1481,7 +1481,7 @@
async function (done, _converse) { async function (done, _converse) {
const groupchat_jid = 'lounge@montague.lit' const groupchat_jid = 'lounge@montague.lit'
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get(groupchat_jid); const view = _converse.chatboxviews.get(groupchat_jid);
const occupants = view.el.querySelector('.occupant-list'); const occupants = view.el.querySelector('.occupant-list');
for (let i=0; i<mock.chatroom_names.length; i++) { for (let i=0; i<mock.chatroom_names.length; i++) {
...@@ -1559,7 +1559,7 @@ ...@@ -1559,7 +1559,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
var name; var name;
var view = _converse.chatboxviews.get('lounge@montague.lit'), var view = _converse.chatboxviews.get('lounge@montague.lit'),
occupants = view.el.querySelector('.occupant-list'); occupants = view.el.querySelector('.occupant-list');
...@@ -1617,7 +1617,7 @@ ...@@ -1617,7 +1617,7 @@
mock.initConverse(null, ['rosterGroupsFetched'], {}, mock.initConverse(null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
/* <presence xmlns="jabber:client" to="jc@chat.example.org/converse.js-17184538" /* <presence xmlns="jabber:client" to="jc@chat.example.org/converse.js-17184538"
* from="oo@conference.chat.example.org/&lt;img src=&quot;x&quot; onerror=&quot;alert(123)&quot;/&gt;"> * from="oo@conference.chat.example.org/&lt;img src=&quot;x&quot; onerror=&quot;alert(123)&quot;/&gt;">
* <x xmlns="http://jabber.org/protocol/muc#user"> * <x xmlns="http://jabber.org/protocol/muc#user">
...@@ -1650,7 +1650,7 @@ ...@@ -1650,7 +1650,7 @@
null, ['rosterGroupsFetched'], {'view_mode': 'fullscreen'}, null, ['rosterGroupsFetched'], {'view_mode': 'fullscreen'},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
let contact_jid = mock.cur_names[2].replace(/ /g,'.').toLowerCase() + '@montague.lit'; let contact_jid = mock.cur_names[2].replace(/ /g,'.').toLowerCase() + '@montague.lit';
...@@ -1749,14 +1749,14 @@ ...@@ -1749,14 +1749,14 @@
const IQ_stanzas = _converse.connection.IQ_stanzas; const IQ_stanzas = _converse.connection.IQ_stanzas;
const sendIQ = _converse.connection.sendIQ; const sendIQ = _converse.connection.sendIQ;
const room_jid = 'lounge@montague.lit'; const muc_jid = 'lounge@montague.lit';
await test_utils.openChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openChatRoom(_converse, 'lounge', 'montague.lit', 'romeo');
let stanza = await test_utils.waitUntil(() => _.filter( let stanza = await test_utils.waitUntil(() => _.filter(
IQ_stanzas, IQ_stanzas,
iq => iq.querySelector( iq => iq.querySelector(
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]` `iq[to="${muc_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
)).pop() )).pop()
); );
// We pretend this is a new room, so no disco info is returned. // We pretend this is a new room, so no disco info is returned.
...@@ -1782,7 +1782,7 @@ ...@@ -1782,7 +1782,7 @@
*/ */
const iq = await test_utils.waitUntil(() => _.filter( const iq = await test_utils.waitUntil(() => _.filter(
IQ_stanzas, IQ_stanzas,
s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s).length s => sizzle(`iq[to="${muc_jid}"] query[node="x-roomuser-item"]`, s).length
).pop() ).pop()
); );
expect(Strophe.serialize(iq)).toBe( expect(Strophe.serialize(iq)).toBe(
...@@ -1858,7 +1858,7 @@ ...@@ -1858,7 +1858,7 @@
'muc_unmoderated', 'muc_unmoderated',
'muc_anonymous' 'muc_anonymous'
] ]
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo', features); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo', features);
spyOn(_converse.api, "trigger").and.callThrough(); spyOn(_converse.api, "trigger").and.callThrough();
spyOn(window, 'prompt').and.callFake(() => "Please join!"); spyOn(window, 'prompt').and.callFake(() => "Please join!");
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
...@@ -1909,13 +1909,13 @@ ...@@ -1909,13 +1909,13 @@
test_utils.createContacts(_converse, 'current'); // We need roster contacts, who can invite us test_utils.createContacts(_converse, 'current'); // We need roster contacts, who can invite us
spyOn(window, 'confirm').and.callFake(() => true); spyOn(window, 'confirm').and.callFake(() => true);
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
view.close(); // Hack, otherwise we have to mock stanzas. view.close(); // Hack, otherwise we have to mock stanzas.
const name = mock.cur_names[0]; const name = mock.cur_names[0];
const from_jid = name.replace(/ /g,'.').toLowerCase() + '@montague.lit'; const from_jid = name.replace(/ /g,'.').toLowerCase() + '@montague.lit';
const room_jid = 'lounge@montague.lit'; const muc_jid = 'lounge@montague.lit';
const reason = "Please join this groupchat"; const reason = "Please join this groupchat";
expect(_converse.chatboxes.models.length).toBe(1); expect(_converse.chatboxes.models.length).toBe(1);
...@@ -1923,15 +1923,15 @@ ...@@ -1923,15 +1923,15 @@
const stanza = u.toStanza(` const stanza = u.toStanza(`
<message xmlns="jabber:client" to="${_converse.bare_jid}" from="${from_jid}" id="9bceb415-f34b-4fa4-80d5-c0d076a24231"> <message xmlns="jabber:client" to="${_converse.bare_jid}" from="${from_jid}" id="9bceb415-f34b-4fa4-80d5-c0d076a24231">
<x xmlns="jabber:x:conference" jid="${room_jid}" reason="${reason}"/> <x xmlns="jabber:x:conference" jid="${muc_jid}" reason="${reason}"/>
</message>`); </message>`);
_converse.onDirectMUCInvitation(stanza); _converse.onDirectMUCInvitation(stanza);
expect(window.confirm).toHaveBeenCalledWith( expect(window.confirm).toHaveBeenCalledWith(
name + ' has invited you to join a groupchat: '+ room_jid + name + ' has invited you to join a groupchat: '+ muc_jid +
', and left the following reason: "'+reason+'"'); ', and left the following reason: "'+reason+'"');
expect(_converse.chatboxes.models.length).toBe(2); expect(_converse.chatboxes.models.length).toBe(2);
expect(_converse.chatboxes.models[0].id).toBe('controlbox'); expect(_converse.chatboxes.models[0].id).toBe('controlbox');
expect(_converse.chatboxes.models[1].id).toBe(room_jid); expect(_converse.chatboxes.models[1].id).toBe(muc_jid);
done(); done();
})); }));
...@@ -1941,7 +1941,7 @@ ...@@ -1941,7 +1941,7 @@
async function (done, _converse) { async function (done, _converse) {
const text = 'This is a received message'; const text = 'This is a received message';
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
spyOn(_converse.api, "trigger"); spyOn(_converse.api, "trigger");
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
if (!view.el.querySelectorAll('.chat-area').length) { if (!view.el.querySelectorAll('.chat-area').length) {
...@@ -1973,7 +1973,7 @@ ...@@ -1973,7 +1973,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
spyOn(_converse.api, "trigger"); spyOn(_converse.api, "trigger");
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
if (!view.el.querySelectorAll('.chat-area').length) { if (!view.el.querySelectorAll('.chat-area').length) {
...@@ -2021,7 +2021,7 @@ ...@@ -2021,7 +2021,7 @@
async function (done, _converse) { async function (done, _converse) {
var message = 'This message is received while the chat area is scrolled up'; var message = 'This message is received while the chat area is scrolled up';
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
var view = _converse.chatboxviews.get('lounge@montague.lit'); var view = _converse.chatboxviews.get('lounge@montague.lit');
spyOn(view, 'scrollDown').and.callThrough(); spyOn(view, 'scrollDown').and.callThrough();
// Create enough messages so that there's a scrollbar. // Create enough messages so that there's a scrollbar.
...@@ -2063,7 +2063,7 @@ ...@@ -2063,7 +2063,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'jdev', 'conference.jabber.org', 'jc'); await test_utils.openAndEnterChatRoom(_converse, 'jdev@conference.jabber.org', 'jc');
const text = 'Jabber/XMPP Development | RFCs and Extensions: https://xmpp.org/ | Protocol and XSF discussions: xsf@muc.xmpp.org'; const text = 'Jabber/XMPP Development | RFCs and Extensions: https://xmpp.org/ | Protocol and XSF discussions: xsf@muc.xmpp.org';
let stanza = u.toStanza(` let stanza = u.toStanza(`
<message xmlns="jabber:client" to="jc@opkode.com/_converse.js-60429116" type="groupchat" from="jdev@conference.jabber.org/ralphm"> <message xmlns="jabber:client" to="jc@opkode.com/_converse.js-60429116" type="groupchat" from="jdev@conference.jabber.org/ralphm">
...@@ -2101,7 +2101,7 @@ ...@@ -2101,7 +2101,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'jdev', 'conference.jabber.org', 'jc'); await test_utils.openAndEnterChatRoom(_converse, 'jdev@conference.jabber.org', 'jc');
spyOn(window, 'alert'); spyOn(window, 'alert');
const subject = '<img src="x" onerror="alert(\'XSS\');"/>'; const subject = '<img src="x" onerror="alert(\'XSS\');"/>';
const view = _converse.chatboxviews.get('jdev@conference.jabber.org'); const view = _converse.chatboxviews.get('jdev@conference.jabber.org');
...@@ -2122,7 +2122,7 @@ ...@@ -2122,7 +2122,7 @@
async function (done, _converse) { async function (done, _converse) {
const groupchat_jid = 'coven@chat.shakespeare.lit'; const groupchat_jid = 'coven@chat.shakespeare.lit';
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo');
const view = _converse.chatboxviews.get(groupchat_jid); const view = _converse.chatboxviews.get(groupchat_jid);
expect(view.model.get('connection_status')).toBe(converse.ROOMSTATUS.ENTERED); expect(view.model.get('connection_status')).toBe(converse.ROOMSTATUS.ENTERED);
await test_utils.sendMessage(view, 'hello world'); await test_utils.sendMessage(view, 'hello world');
...@@ -2176,7 +2176,7 @@ ...@@ -2176,7 +2176,7 @@
async function (done, _converse) { async function (done, _converse) {
const groupchat_jid = 'coven@chat.shakespeare.lit'; const groupchat_jid = 'coven@chat.shakespeare.lit';
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo');
const view = _converse.chatboxviews.get(groupchat_jid); const view = _converse.chatboxviews.get(groupchat_jid);
expect(view.model.get('connection_status')).toBe(converse.ROOMSTATUS.ENTERED); expect(view.model.get('connection_status')).toBe(converse.ROOMSTATUS.ENTERED);
...@@ -2239,7 +2239,7 @@ ...@@ -2239,7 +2239,7 @@
* </presence> * </presence>
*/ */
const __ = _converse.__; const __ = _converse.__;
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'oldnick'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'oldnick');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
expect(view.model.get('connection_status')).toBe(converse.ROOMSTATUS.ENTERED); expect(view.model.get('connection_status')).toBe(converse.ROOMSTATUS.ENTERED);
const chat_content = view.el.querySelector('.chat-content'); const chat_content = view.el.querySelector('.chat-content');
...@@ -2315,18 +2315,18 @@ ...@@ -2315,18 +2315,18 @@
async function (done, _converse) { async function (done, _converse) {
const IQ_stanzas = _converse.connection.IQ_stanzas; const IQ_stanzas = _converse.connection.IQ_stanzas;
const room_jid = 'coven@chat.shakespeare.lit'; const muc_jid = 'coven@chat.shakespeare.lit';
await _converse.api.rooms.open(room_jid, {'nick': 'some1'}); await _converse.api.rooms.open(muc_jid, {'nick': 'some1'});
const stanza = await test_utils.waitUntil(() => _.filter( const stanza = await test_utils.waitUntil(() => _.filter(
IQ_stanzas, IQ_stanzas,
iq => iq.querySelector( iq => iq.querySelector(
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]` `iq[to="${muc_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
)).pop()); )).pop());
// Check that the groupchat queried for the feautures. // Check that the groupchat queried for the feautures.
expect(Strophe.serialize(stanza)).toBe( expect(Strophe.serialize(stanza)).toBe(
`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute("id")}" to="${room_jid}" type="get" xmlns="jabber:client">`+ `<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute("id")}" to="${muc_jid}" type="get" xmlns="jabber:client">`+
`<query xmlns="http://jabber.org/protocol/disco#info"/>`+ `<query xmlns="http://jabber.org/protocol/disco#info"/>`+
`</iq>`); `</iq>`);
...@@ -2350,7 +2350,7 @@ ...@@ -2350,7 +2350,7 @@
* </iq> * </iq>
*/ */
const features_stanza = $iq({ const features_stanza = $iq({
'from': room_jid, 'from': muc_jid,
'id': stanza.getAttribute('id'), 'id': stanza.getAttribute('id'),
'to': 'romeo@montague.lit/desktop', 'to': 'romeo@montague.lit/desktop',
'type': 'result' 'type': 'result'
...@@ -2397,7 +2397,7 @@ ...@@ -2397,7 +2397,7 @@
'muc_unmoderated', 'muc_unmoderated',
'muc_nonanonymous' 'muc_nonanonymous'
]; ];
await test_utils.openAndEnterChatRoom(_converse, 'room', 'conference.example.org', 'romeo', features); await test_utils.openAndEnterChatRoom(_converse, 'room@conference.example.org', 'romeo', features);
const jid = 'room@conference.example.org'; const jid = 'room@conference.example.org';
const chatroomview = _converse.chatboxviews.get(jid); const chatroomview = _converse.chatboxviews.get(jid);
let features_list = chatroomview.el.querySelector('.features-list'); let features_list = chatroomview.el.querySelector('.features-list');
...@@ -2578,7 +2578,7 @@ ...@@ -2578,7 +2578,7 @@
let sent_IQ, IQ_id; let sent_IQ, IQ_id;
const sendIQ = _converse.connection.sendIQ; const sendIQ = _converse.connection.sendIQ;
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'some1'); await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'some1');
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) { spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
sent_IQ = iq; sent_IQ = iq;
IQ_id = sendIQ.bind(this)(iq, callback, errback); IQ_id = sendIQ.bind(this)(iq, callback, errback);
...@@ -2639,7 +2639,7 @@ ...@@ -2639,7 +2639,7 @@
* </x> * </x>
* </presence> * </presence>
*/ */
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
var presence = $pres().attrs({ var presence = $pres().attrs({
from:'lounge@montague.lit/romeo', from:'lounge@montague.lit/romeo',
to:'romeo@montague.lit/pda', to:'romeo@montague.lit/pda',
...@@ -2765,7 +2765,7 @@ ...@@ -2765,7 +2765,7 @@
async function (done, _converse) { async function (done, _converse) {
spyOn(window, 'confirm').and.callFake(() => true); spyOn(window, 'confirm').and.callFake(() => true);
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
const textarea = view.el.querySelector('.chat-textarea'); const textarea = view.el.querySelector('.chat-textarea');
textarea.value = '/clear'; textarea.value = '/clear';
...@@ -2838,7 +2838,7 @@ ...@@ -2838,7 +2838,7 @@
null, ['rosterGroupsFetched'], {muc_disable_slash_commands: ['mute', 'voice']}, null, ['rosterGroupsFetched'], {muc_disable_slash_commands: ['mute', 'voice']},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
var textarea = view.el.querySelector('.chat-textarea'); var textarea = view.el.querySelector('.chat-textarea');
const enter = { 'target': textarea, 'preventDefault': _.noop, 'keyCode': 13 }; const enter = { 'target': textarea, 'preventDefault': _.noop, 'keyCode': 13 };
...@@ -2876,7 +2876,7 @@ ...@@ -2876,7 +2876,7 @@
async function (done, _converse) { async function (done, _converse) {
let iq_stanza; let iq_stanza;
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'muc.montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@muc.montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@muc.montague.lit'); const view = _converse.chatboxviews.get('lounge@muc.montague.lit');
/* We don't show join/leave messages for existing occupants. We /* We don't show join/leave messages for existing occupants. We
* know about them because we receive their presences before we * know about them because we receive their presences before we
...@@ -3020,7 +3020,7 @@ ...@@ -3020,7 +3020,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
spyOn(view, 'clearMessages'); spyOn(view, 'clearMessages');
let sent_stanza; let sent_stanza;
...@@ -3072,7 +3072,7 @@ ...@@ -3072,7 +3072,7 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
spyOn(view, 'clearMessages'); spyOn(view, 'clearMessages');
const textarea = view.el.querySelector('.chat-textarea') const textarea = view.el.querySelector('.chat-textarea')
...@@ -3098,7 +3098,7 @@ ...@@ -3098,7 +3098,7 @@
IQ_id = sendIQ.bind(this)(iq, callback, errback); IQ_id = sendIQ.bind(this)(iq, callback, errback);
}); });
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
spyOn(view.model, 'setAffiliation').and.callThrough(); spyOn(view.model, 'setAffiliation').and.callThrough();
spyOn(view, 'showErrorMessage').and.callThrough(); spyOn(view, 'showErrorMessage').and.callThrough();
...@@ -3186,7 +3186,7 @@ ...@@ -3186,7 +3186,7 @@
IQ_id = sendIQ.bind(this)(iq, callback, errback); IQ_id = sendIQ.bind(this)(iq, callback, errback);
}); });
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
spyOn(view.model, 'setAffiliation').and.callThrough(); spyOn(view.model, 'setAffiliation').and.callThrough();
spyOn(view, 'showErrorMessage').and.callThrough(); spyOn(view, 'showErrorMessage').and.callThrough();
...@@ -3286,8 +3286,9 @@ ...@@ -3286,8 +3286,9 @@
IQ_id = sendIQ.bind(this)(iq, callback, errback); IQ_id = sendIQ.bind(this)(iq, callback, errback);
}); });
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
const view = _converse.chatboxviews.get('lounge@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
spyOn(view.model, 'setRole').and.callThrough(); spyOn(view.model, 'setRole').and.callThrough();
spyOn(view, 'showErrorMessage').and.callThrough(); spyOn(view, 'showErrorMessage').and.callThrough();
spyOn(view, 'validateRoleOrAffiliationChangeArgs').and.callThrough(); spyOn(view, 'validateRoleOrAffiliationChangeArgs').and.callThrough();
...@@ -3370,14 +3371,15 @@ ...@@ -3370,14 +3371,15 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
var sent_IQ, IQ_id; var sent_IQ, IQ_id;
var sendIQ = _converse.connection.sendIQ; var sendIQ = _converse.connection.sendIQ;
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) { spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
sent_IQ = iq; sent_IQ = iq;
IQ_id = sendIQ.bind(this)(iq, callback, errback); IQ_id = sendIQ.bind(this)(iq, callback, errback);
}); });
const view = _converse.chatboxviews.get('lounge@montague.lit');
spyOn(view.model, 'setRole').and.callThrough(); spyOn(view.model, 'setRole').and.callThrough();
spyOn(view, 'showErrorMessage').and.callThrough(); spyOn(view, 'showErrorMessage').and.callThrough();
spyOn(view, 'showChatEvent').and.callThrough(); spyOn(view, 'showChatEvent').and.callThrough();
...@@ -3512,14 +3514,15 @@ ...@@ -3512,14 +3514,15 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
var sent_IQ, IQ_id; var sent_IQ, IQ_id;
var sendIQ = _converse.connection.sendIQ; var sendIQ = _converse.connection.sendIQ;
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) { spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
sent_IQ = iq; sent_IQ = iq;
IQ_id = sendIQ.bind(this)(iq, callback, errback); IQ_id = sendIQ.bind(this)(iq, callback, errback);
}); });
var view = _converse.chatboxviews.get('lounge@montague.lit');
spyOn(view.model, 'setRole').and.callThrough(); spyOn(view.model, 'setRole').and.callThrough();
spyOn(view, 'showErrorMessage').and.callThrough(); spyOn(view, 'showErrorMessage').and.callThrough();
spyOn(view, 'showChatEvent').and.callThrough(); spyOn(view, 'showChatEvent').and.callThrough();
...@@ -3655,14 +3658,15 @@ ...@@ -3655,14 +3658,15 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); const muc_jid = 'lounge@montague.lit';
await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo');
const view = _converse.api.chatviews.get(muc_jid);
let sent_IQ, IQ_id; let sent_IQ, IQ_id;
const sendIQ = _converse.connection.sendIQ; const sendIQ = _converse.connection.sendIQ;
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) { spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
sent_IQ = iq; sent_IQ = iq;
IQ_id = sendIQ.bind(this)(iq, callback, errback); IQ_id = sendIQ.bind(this)(iq, callback, errback);
}); });
const view = _converse.chatboxviews.get('lounge@montague.lit');
const textarea = view.el.querySelector('.chat-textarea'); const textarea = view.el.querySelector('.chat-textarea');
textarea.value = '/destroy bored'; textarea.value = '/destroy bored';
view.onFormSubmitted(new Event('submit')); view.onFormSubmitted(new Event('submit'));
...@@ -4111,21 +4115,21 @@ ...@@ -4111,21 +4115,21 @@
var sent_IQs = [], IQ_ids = []; var sent_IQs = [], IQ_ids = [];
const sendIQ = _converse.connection.sendIQ; const sendIQ = _converse.connection.sendIQ;
const IQ_stanzas = _converse.connection.IQ_stanzas; const IQ_stanzas = _converse.connection.IQ_stanzas;
const room_jid = 'coven@chat.shakespeare.lit'; const muc_jid = 'coven@chat.shakespeare.lit';
spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) { spyOn(_converse.connection, 'sendIQ').and.callFake(function (iq, callback, errback) {
sent_IQs.push(iq); sent_IQs.push(iq);
IQ_ids.push(sendIQ.bind(this)(iq, callback, errback)); IQ_ids.push(sendIQ.bind(this)(iq, callback, errback));
}); });
await _converse.api.rooms.open(room_jid, {'nick': 'romeo'}); await _converse.api.rooms.open(muc_jid, {'nick': 'romeo'});
let stanza = await test_utils.waitUntil(() => _.filter( let stanza = await test_utils.waitUntil(() => _.filter(
IQ_stanzas, IQ_stanzas,
iq => iq.querySelector( iq => iq.querySelector(
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]` `iq[to="${muc_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
)).pop()); )).pop());
// Check that the groupchat queried for the feautures. // Check that the groupchat queried for the feautures.
expect(Strophe.serialize(stanza)).toBe( expect(Strophe.serialize(stanza)).toBe(
`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute("id")}" to="${room_jid}" type="get" xmlns="jabber:client">`+ `<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute("id")}" to="${muc_jid}" type="get" xmlns="jabber:client">`+
`<query xmlns="http://jabber.org/protocol/disco#info"/>`+ `<query xmlns="http://jabber.org/protocol/disco#info"/>`+
`</iq>`); `</iq>`);
...@@ -4246,7 +4250,7 @@ ...@@ -4246,7 +4250,7 @@
stanza = await test_utils.waitUntil(() => _.filter( stanza = await test_utils.waitUntil(() => _.filter(
IQ_stanzas, IQ_stanzas,
iq => iq.querySelector( iq => iq.querySelector(
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/muc#admin"]` `iq[to="${muc_jid}"] query[xmlns="http://jabber.org/protocol/muc#admin"]`
)).pop()); )).pop());
expect(stanza.outerHTML, expect(stanza.outerHTML,
`<iq id="${IQ_ids.pop()}" to="coven@chat.shakespeare.lit" type="set" xmlns="jabber:client">`+ `<iq id="${IQ_ids.pop()}" to="coven@chat.shakespeare.lit" type="set" xmlns="jabber:client">`+
...@@ -4671,20 +4675,20 @@ ...@@ -4671,20 +4675,20 @@
const roomspanel = _converse.chatboxviews.get('controlbox').roomspanel; const roomspanel = _converse.chatboxviews.get('controlbox').roomspanel;
expect(roomspanel.el.querySelectorAll('.available-room').length).toBe(0); expect(roomspanel.el.querySelectorAll('.available-room').length).toBe(0);
const room_jid = 'kitchen@conference.shakespeare.lit'; const muc_jid = 'kitchen@conference.shakespeare.lit';
const message = 'fires: Your attention is required'; const message = 'fires: Your attention is required';
await test_utils.openAndEnterChatRoom(_converse, 'kitchen', 'conference.shakespeare.lit', 'fires'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'fires');
const view = _converse.api.chatviews.get(muc_jid);
expect(roomspanel.el.querySelectorAll('.available-room').length).toBe(1); expect(roomspanel.el.querySelectorAll('.available-room').length).toBe(1);
expect(roomspanel.el.querySelectorAll('.msgs-indicator').length).toBe(0); expect(roomspanel.el.querySelectorAll('.msgs-indicator').length).toBe(0);
const view = _converse.chatboxviews.get(room_jid);
view.model.set({'minimized': true}); view.model.set({'minimized': true});
const contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit'; const contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit';
const nick = mock.chatroom_names[0]; const nick = mock.chatroom_names[0];
await view.model.onMessage($msg({ await view.model.onMessage($msg({
from: room_jid+'/'+nick, from: muc_jid+'/'+nick,
id: (new Date()).getTime(), id: (new Date()).getTime(),
to: 'romeo@montague.lit', to: 'romeo@montague.lit',
type: 'groupchat' type: 'groupchat'
...@@ -4695,7 +4699,7 @@ ...@@ -4695,7 +4699,7 @@
expect(roomspanel.el.querySelector('.msgs-indicator').textContent).toBe('1'); expect(roomspanel.el.querySelector('.msgs-indicator').textContent).toBe('1');
await view.model.onMessage($msg({ await view.model.onMessage($msg({
'from': room_jid+'/'+nick, 'from': muc_jid+'/'+nick,
'id': (new Date()).getTime(), 'id': (new Date()).getTime(),
'to': 'romeo@montague.lit', 'to': 'romeo@montague.lit',
'type': 'groupchat' 'type': 'groupchat'
...@@ -4720,9 +4724,9 @@ ...@@ -4720,9 +4724,9 @@
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
async function (done, _converse) { async function (done, _converse) {
const room_jid = 'coven@chat.shakespeare.lit'; const muc_jid = 'coven@chat.shakespeare.lit';
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'some1'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'some1');
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit'); const view = _converse.api.chatviews.get(muc_jid);
const chat_content = view.el.querySelector('.chat-content'); const chat_content = view.el.querySelector('.chat-content');
expect(sizzle('div.chat-info:first', chat_content).pop().textContent) expect(sizzle('div.chat-info:first', chat_content).pop().textContent)
...@@ -4762,7 +4766,7 @@ ...@@ -4762,7 +4766,7 @@
// <composing> state // <composing> state
let msg = $msg({ let msg = $msg({
from: room_jid+'/newguy', from: muc_jid+'/newguy',
id: (new Date()).getTime(), id: (new Date()).getTime(),
to: 'romeo@montague.lit', to: 'romeo@montague.lit',
type: 'groupchat' type: 'groupchat'
...@@ -4787,7 +4791,7 @@ ...@@ -4787,7 +4791,7 @@
// Check that it doesn't appear twice // Check that it doesn't appear twice
msg = $msg({ msg = $msg({
from: room_jid+'/newguy', from: muc_jid+'/newguy',
id: (new Date()).getTime(), id: (new Date()).getTime(),
to: 'romeo@montague.lit', to: 'romeo@montague.lit',
type: 'groupchat' type: 'groupchat'
...@@ -4807,7 +4811,7 @@ ...@@ -4807,7 +4811,7 @@
// <composing> state for a different occupant // <composing> state for a different occupant
msg = $msg({ msg = $msg({
from: room_jid+'/nomorenicks', from: muc_jid+'/nomorenicks',
id: (new Date()).getTime(), id: (new Date()).getTime(),
to: 'romeo@montague.lit', to: 'romeo@montague.lit',
type: 'groupchat' type: 'groupchat'
...@@ -4827,7 +4831,7 @@ ...@@ -4827,7 +4831,7 @@
// Check that new messages appear under the chat state notifications // Check that new messages appear under the chat state notifications
msg = $msg({ msg = $msg({
from: `${room_jid}/some1`, from: `${muc_jid}/some1`,
id: (new Date()).getTime(), id: (new Date()).getTime(),
to: 'romeo@montague.lit', to: 'romeo@montague.lit',
type: 'groupchat' type: 'groupchat'
...@@ -4872,7 +4876,7 @@ ...@@ -4872,7 +4876,7 @@
async function (done, _converse) { async function (done, _converse) {
await test_utils.openChatRoom(_converse, "coven", 'chat.shakespeare.lit', 'some1'); await test_utils.openChatRoom(_converse, "coven", 'chat.shakespeare.lit', 'some1');
const room_jid = 'coven@chat.shakespeare.lit'; const muc_jid = 'coven@chat.shakespeare.lit';
const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit'); const view = _converse.chatboxviews.get('coven@chat.shakespeare.lit');
const chat_content = view.el.querySelector('.chat-content'); const chat_content = view.el.querySelector('.chat-content');
...@@ -4932,7 +4936,7 @@ ...@@ -4932,7 +4936,7 @@
// <composing> state // <composing> state
var msg = $msg({ var msg = $msg({
from: room_jid+'/newguy', from: muc_jid+'/newguy',
id: (new Date()).getTime(), id: (new Date()).getTime(),
to: 'romeo@montague.lit', to: 'romeo@montague.lit',
type: 'groupchat' type: 'groupchat'
...@@ -4953,7 +4957,7 @@ ...@@ -4953,7 +4957,7 @@
// Check that it doesn't appear twice // Check that it doesn't appear twice
msg = $msg({ msg = $msg({
from: room_jid+'/newguy', from: muc_jid+'/newguy',
id: (new Date()).getTime(), id: (new Date()).getTime(),
to: 'romeo@montague.lit', to: 'romeo@montague.lit',
type: 'groupchat' type: 'groupchat'
...@@ -4972,7 +4976,7 @@ ...@@ -4972,7 +4976,7 @@
// <composing> state for a different occupant // <composing> state for a different occupant
msg = $msg({ msg = $msg({
from: room_jid+'/nomorenicks', from: muc_jid+'/nomorenicks',
id: (new Date()).getTime(), id: (new Date()).getTime(),
to: 'romeo@montague.lit', to: 'romeo@montague.lit',
type: 'groupchat' type: 'groupchat'
...@@ -4995,7 +4999,7 @@ ...@@ -4995,7 +4999,7 @@
// <paused> state from occupant who typed first // <paused> state from occupant who typed first
msg = $msg({ msg = $msg({
from: room_jid+'/newguy', from: muc_jid+'/newguy',
id: (new Date()).getTime(), id: (new Date()).getTime(),
to: 'romeo@montague.lit', to: 'romeo@montague.lit',
type: 'groupchat' type: 'groupchat'
...@@ -5029,8 +5033,9 @@ ...@@ -5029,8 +5033,9 @@
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {}, null, ['rosterGroupsFetched', 'chatBoxesFetched'], {},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'trollbox', 'montague.lit', 'troll'); const muc_jid = 'trollbox@montague.lit';
const view = _converse.chatboxviews.get('trollbox@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'troll');
const view = _converse.api.chatviews.get(muc_jid);
const textarea = view.el.querySelector('.chat-textarea'); const textarea = view.el.querySelector('.chat-textarea');
textarea.value = 'Hello world'; textarea.value = 'Hello world';
view.onFormSubmitted(new Event('submit')); view.onFormSubmitted(new Event('submit'));
...@@ -5058,8 +5063,9 @@ ...@@ -5058,8 +5063,9 @@
Strophe.NS.SID, Strophe.NS.SID,
'muc_moderated', 'muc_moderated',
] ]
await test_utils.openAndEnterChatRoom(_converse, 'trollbox', 'montague.lit', 'troll', features); const muc_jid = 'trollbox@montague.lit';
const view = _converse.chatboxviews.get('trollbox@montague.lit'); await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'troll', features);
const view = _converse.api.chatviews.get(muc_jid);
expect(_.isNull(view.el.querySelector('.chat-textarea'))).toBe(false); expect(_.isNull(view.el.querySelector('.chat-textarea'))).toBe(false);
let stanza = u.toStanza(` let stanza = u.toStanza(`
......
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
async (done, _converse) => { async (done, _converse) => {
await test_utils.createContacts(_converse, 'current'); await test_utils.createContacts(_converse, 'current');
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.api.chatviews.get('lounge@montague.lit'); const view = _converse.api.chatviews.get('lounge@montague.lit');
if (!view.el.querySelectorAll('.chat-area').length) { if (!view.el.querySelectorAll('.chat-area').length) {
view.renderChatArea(); view.renderChatArea();
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
async (done, _converse) => { async (done, _converse) => {
test_utils.createContacts(_converse, 'current'); test_utils.createContacts(_converse, 'current');
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
_converse.play_sounds = true; _converse.play_sounds = true;
spyOn(_converse, 'playSoundNotification'); spyOn(_converse, 'playSoundNotification');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
......
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
'muc_unmoderated', 'muc_unmoderated',
'muc_nonanonymous' 'muc_nonanonymous'
]; ];
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo', features); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo', features);
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
await test_utils.waitUntil(() => initializedOMEMO(_converse)); await test_utils.waitUntil(() => initializedOMEMO(_converse));
...@@ -490,7 +490,7 @@ ...@@ -490,7 +490,7 @@
'muc_unmoderated', 'muc_unmoderated',
'muc_nonanonymous' 'muc_nonanonymous'
]; ];
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo', features); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo', features);
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
await test_utils.waitUntil(() => initializedOMEMO(_converse)); await test_utils.waitUntil(() => initializedOMEMO(_converse));
...@@ -1282,7 +1282,7 @@ ...@@ -1282,7 +1282,7 @@
['http://jabber.org/protocol/pubsub#publish-options'] ['http://jabber.org/protocol/pubsub#publish-options']
); );
// MEMO encryption works only in members-only conferences that are non-anonymous. // MEMO encryption works only in members-only conferences that are non-anonymous.
const features = [ const features = [
'http://jabber.org/protocol/muc', 'http://jabber.org/protocol/muc',
'jabber:iq:register', 'jabber:iq:register',
...@@ -1293,7 +1293,7 @@ ...@@ -1293,7 +1293,7 @@
'muc_unmoderated', 'muc_unmoderated',
'muc_nonanonymous' 'muc_nonanonymous'
]; ];
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo', features); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo', features);
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
await test_utils.waitUntil(() => initializedOMEMO(_converse)); await test_utils.waitUntil(() => initializedOMEMO(_converse));
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
async function (done, _converse) { async function (done, _converse) {
test_utils.openControlBox(); test_utils.openControlBox();
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'), const view = _converse.chatboxviews.get('lounge@montague.lit'),
occupants = view.el.querySelector('.occupant-list'); occupants = view.el.querySelector('.occupant-list');
_.rangeRight(3000, 0).forEach(i => { _.rangeRight(3000, 0).forEach(i => {
......
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
expect(_converse.session.get('push_enabled').length).toBe(1); expect(_converse.session.get('push_enabled').length).toBe(1);
expect(_.includes(_converse.session.get('push_enabled'), 'romeo@montague.lit')).toBe(true); expect(_.includes(_converse.session.get('push_enabled'), 'romeo@montague.lit')).toBe(true);
test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'oldhag'); test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'oldhag');
await test_utils.waitUntilDiscoConfirmed( await test_utils.waitUntilDiscoConfirmed(
_converse, 'chat.shakespeare.lit', _converse, 'chat.shakespeare.lit',
[{'category': 'account', 'type':'registered'}], [{'category': 'account', 'type':'registered'}],
......
...@@ -16,59 +16,54 @@ ...@@ -16,59 +16,54 @@
it("allows you to register your nickname in a room", it("allows you to register your nickname in a room",
mock.initConverse( mock.initConverse(
null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'auto_register_muc_nickname': true}, null, ['rosterGroupsFetched', 'chatBoxesFetched'], {'auto_register_muc_nickname': true},
function (done, _converse) { async function (done, _converse) {
let view; const muc_jid = 'coven@chat.shakespeare.lit';
const room_jid = 'coven@chat.shakespeare.lit'; await test_utils.openAndEnterChatRoom(_converse, muc_jid, 'romeo')
test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo') const view = _converse.chatboxviews.get(muc_jid);
.then(() => { const textarea = view.el.querySelector('.chat-textarea')
view = _converse.chatboxviews.get(room_jid); textarea.value = '/register';
const textarea = view.el.querySelector('.chat-textarea') view.onKeyDown({
textarea.value = '/register'; target: textarea,
view.onKeyDown({ preventDefault: _.noop,
target: textarea, keyCode: 13
preventDefault: _.noop, });
keyCode: 13 let stanza = await test_utils.waitUntil(() => _.filter(
}); _converse.connection.IQ_stanzas,
return test_utils.waitUntil(() => _.filter( iq => sizzle(`iq[to="${muc_jid}"][type="get"] query[xmlns="jabber:iq:register"]`, iq).length
_converse.connection.IQ_stanzas, ).pop());
iq => sizzle(`iq[to="coven@chat.shakespeare.lit"][type="get"] query[xmlns="jabber:iq:register"]`, iq).length expect(Strophe.serialize(stanza))
).pop());
}).then(stanza => {
expect(Strophe.serialize(stanza))
.toBe(`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute('id')}" to="coven@chat.shakespeare.lit" `+ .toBe(`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute('id')}" to="coven@chat.shakespeare.lit" `+
`type="get" xmlns="jabber:client">`+ `type="get" xmlns="jabber:client">`+
`<query xmlns="jabber:iq:register"/></iq>`); `<query xmlns="jabber:iq:register"/></iq>`);
view = _converse.chatboxviews.get(room_jid); const result = $iq({
const result = $iq({ 'from': view.model.get('jid'),
'from': view.model.get('jid'), 'id': stanza.getAttribute('id'),
'id': stanza.getAttribute('id'), 'to': _converse.bare_jid,
'to': _converse.bare_jid, 'type': 'result',
'type': 'result', }).c('query', {'type': 'jabber:iq:register'})
}).c('query', {'type': 'jabber:iq:register'}) .c('x', {'xmlns': 'jabber:x:data', 'type': 'form'})
.c('x', {'xmlns': 'jabber:x:data', 'type': 'form'}) .c('field', {
.c('field', { 'label': 'Desired Nickname',
'label': 'Desired Nickname', 'type': 'text-single',
'type': 'text-single', 'var': 'muc#register_roomnick'
'var': 'muc#register_roomnick' }).c('required');
}).c('required'); _converse.connection._dataRecv(test_utils.createRequest(result));
_converse.connection._dataRecv(test_utils.createRequest(result)); stanza = await test_utils.waitUntil(() => _.filter(
return test_utils.waitUntil(() => _.filter( _converse.connection.IQ_stanzas,
_converse.connection.IQ_stanzas, iq => sizzle(`iq[to="${muc_jid}"][type="set"] query[xmlns="jabber:iq:register"]`, iq).length
iq => sizzle(`iq[to="coven@chat.shakespeare.lit"][type="set"] query[xmlns="jabber:iq:register"]`, iq).length ).pop());
).pop());
}).then(stanza => { expect(Strophe.serialize(stanza)).toBe(
expect(Strophe.serialize(stanza)).toBe( `<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute('id')}" to="coven@chat.shakespeare.lit" type="set" xmlns="jabber:client">`+
`<iq from="romeo@montague.lit/orchard" id="${stanza.getAttribute('id')}" to="coven@chat.shakespeare.lit" type="set" xmlns="jabber:client">`+ `<query xmlns="jabber:iq:register">`+
`<query xmlns="jabber:iq:register">`+ `<x type="submit" xmlns="jabber:x:data">`+
`<x type="submit" xmlns="jabber:x:data">`+ `<field var="FORM_TYPE"><value>http://jabber.org/protocol/muc#register</value></field>`+
`<field var="FORM_TYPE"><value>http://jabber.org/protocol/muc#register</value></field>`+ `<field var="muc#register_roomnick"><value>romeo</value></field>`+
`<field var="muc#register_roomnick"><value>romeo</value></field>`+ `</x>`+
`</x>`+ `</query>`+
`</query>`+ `</iq>`);
`</iq>`); done();
done();
}).catch(_.partial(_converse.log, _, Strophe.LogLevel.FATAL));
})); }));
}); });
...@@ -81,9 +76,9 @@ ...@@ -81,9 +76,9 @@
async function (done, _converse) { async function (done, _converse) {
const IQ_stanzas = _converse.connection.IQ_stanzas; const IQ_stanzas = _converse.connection.IQ_stanzas;
const room_jid = 'coven@chat.shakespeare.lit'; const muc_jid = 'coven@chat.shakespeare.lit';
await test_utils.openAndEnterChatRoom(_converse, 'coven', 'chat.shakespeare.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'coven@chat.shakespeare.lit', 'romeo');
const view = _converse.chatboxviews.get(room_jid); const view = _converse.chatboxviews.get(muc_jid);
let stanza = await test_utils.waitUntil(() => _.filter( let stanza = await test_utils.waitUntil(() => _.filter(
_converse.connection.IQ_stanzas, _converse.connection.IQ_stanzas,
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
{'connection': ['send']}, ['rosterGroupsFetched', 'chatBoxesFetched'], {'view_mode': 'fullscreen'}, {'connection': ['send']}, ['rosterGroupsFetched', 'chatBoxesFetched'], {'view_mode': 'fullscreen'},
async function (done, _converse) { async function (done, _converse) {
await test_utils.openAndEnterChatRoom(_converse, 'lounge', 'montague.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo');
const view = _converse.chatboxviews.get('lounge@montague.lit'); const view = _converse.chatboxviews.get('lounge@montague.lit');
const contact_jid = 'newguy@montague.lit'; const contact_jid = 'newguy@montague.lit';
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
test_utils.openControlBox(); test_utils.openControlBox();
const room_jid = 'kitchen@conference.shakespeare.lit'; const room_jid = 'kitchen@conference.shakespeare.lit';
await test_utils.waitUntil(() => !_.isUndefined(_converse.rooms_list_view), 500); await test_utils.waitUntil(() => !_.isUndefined(_converse.rooms_list_view), 500);
await test_utils.openAndEnterChatRoom(_converse, 'kitchen', 'conference.shakespeare.lit', 'romeo'); await test_utils.openAndEnterChatRoom(_converse, 'kitchen@conference.shakespeare.lit', 'romeo');
const view = _converse.chatboxviews.get(room_jid); const view = _converse.chatboxviews.get(room_jid);
view.model.set({'minimized': true}); view.model.set({'minimized': true});
const contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit'; const contact_jid = mock.cur_names[5].replace(/ /g,'.').toLowerCase() + '@montague.lit';
......
...@@ -49,32 +49,30 @@ ...@@ -49,32 +49,30 @@
return describe("Transcripts of chat logs", function () { return describe("Transcripts of chat logs", function () {
it("can be used to replay conversations", it("can be used to replay conversations",
mock.initConverse( mock.initConverse(
null, ['rosterGroupsFetched'], {}, null, ['rosterGroupsFetched'], {},
function (done, _converse) { async function (done, _converse) {
_converse.allow_non_roster_messaging = true; _converse.allow_non_roster_messaging = true;
await test_utils.openAndEnterChatRoom(_converse, 'discuss@conference.conversejs.org', 'romeo');
test_utils.openAndEnterChatRoom(_converse, 'discuss', 'conference.conversejs.org', 'romeo').then(function () { spyOn(_converse, 'areDesktopNotificationsEnabled').and.returnValue(true);
spyOn(_converse, 'areDesktopNotificationsEnabled').and.returnValue(true); _.each(transcripts, function (transcript) {
_.each(transcripts, function (transcript) { const text = transcript();
var text = transcript(); const xml = Strophe.xmlHtmlNode(text);
var xml = Strophe.xmlHtmlNode(text); _.each(xml.firstElementChild.children, function (el) {
_.each(xml.firstElementChild.children, function (el) { _.each(el.children, function (el) {
_.each(el.children, function (el) { if (el.nodeType === 3) {
if (el.nodeType === 3) { return; // Ignore text
return; // Ignore text }
} if (_.includes(IGNORED_TAGS, el.nodeName.toLowerCase())) {
if (_.includes(IGNORED_TAGS, el.nodeName.toLowerCase())) { return;
return; }
} const _stanza = traverseElement(el);
var _stanza = traverseElement(el); _converse.connection._dataRecv(test_utils.createRequest(_stanza));
_converse.connection._dataRecv(test_utils.createRequest(_stanza));
});
}); });
}); });
done();
}); });
done();
})); }));
}); });
})); }));
...@@ -164,7 +164,9 @@ ...@@ -164,7 +164,9 @@
_converse.connection._dataRecv(utils.createRequest(features_stanza)); _converse.connection._dataRecv(utils.createRequest(features_stanza));
}; };
utils.openAndEnterChatRoom = async function (_converse, room, server, nick, features=[]) { utils.openAndEnterChatRoom = async function (_converse, muc_jid, nick, features=[]) {
const room = Strophe.getNodeFromJid(muc_jid);
const server = Strophe.getDomainFromJid(muc_jid);
const room_jid = `${room}@${server}`.toLowerCase(); const room_jid = `${room}@${server}`.toLowerCase();
const stanzas = _converse.connection.IQ_stanzas; const stanzas = _converse.connection.IQ_stanzas;
await _converse.api.rooms.open(room_jid); await _converse.api.rooms.open(room_jid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment