Clear MUC disco after closing a room
This is to avoid having a stale/inaccurate MUC features list when reopening a previously closed MUC
This commit is contained in:
parent
cd05b89726
commit
dee10bfe45
@ -304,6 +304,10 @@
|
|||||||
*/
|
*/
|
||||||
this.occupants.browserStorage._clear();
|
this.occupants.browserStorage._clear();
|
||||||
this.occupants.reset();
|
this.occupants.reset();
|
||||||
|
const disco_entity = _converse.disco_entities.get(this.get('jid'));
|
||||||
|
if (disco_entity) {
|
||||||
|
disco_entity.destroy();
|
||||||
|
}
|
||||||
if (_converse.connection.connected) {
|
if (_converse.connection.connected) {
|
||||||
this.sendUnavailablePresence(exit_msg);
|
this.sendUnavailablePresence(exit_msg);
|
||||||
}
|
}
|
||||||
|
@ -130,42 +130,39 @@
|
|||||||
|
|
||||||
return _converse.api.rooms.open(room_jid).then(() => {
|
return _converse.api.rooms.open(room_jid).then(() => {
|
||||||
view = _converse.chatboxviews.get(room_jid);
|
view = _converse.chatboxviews.get(room_jid);
|
||||||
if (!_converse.disco_entities.get(room_jid)) {
|
return utils.waitUntil(() => _.get(_.filter(
|
||||||
utils.waitUntil(() => _.get(_.filter(
|
stanzas,
|
||||||
stanzas,
|
iq => iq.nodeTree.querySelector(
|
||||||
iq => iq.nodeTree.querySelector(
|
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
||||||
`iq[to="${room_jid}"] query[xmlns="http://jabber.org/protocol/disco#info"]`
|
)).pop(), 'nodeTree'));
|
||||||
)).pop(), 'nodeTree'))
|
}).then(stanza => {
|
||||||
.then(stanza => {
|
const features_stanza = $iq({
|
||||||
const features_stanza = $iq({
|
'from': room_jid,
|
||||||
'from': room_jid,
|
'id': stanza.getAttribute('id'),
|
||||||
'id': stanza.getAttribute('id'),
|
'to': 'dummy@localhost/desktop',
|
||||||
'to': 'dummy@localhost/desktop',
|
'type': 'result'
|
||||||
'type': 'result'
|
}).c('query', { 'xmlns': 'http://jabber.org/protocol/disco#info'})
|
||||||
}).c('query', { 'xmlns': 'http://jabber.org/protocol/disco#info'})
|
.c('identity', {
|
||||||
.c('identity', {
|
'category': 'conference',
|
||||||
'category': 'conference',
|
'name': room[0].toUpperCase() + room.slice(1),
|
||||||
'name': room[0].toUpperCase() + room.slice(1),
|
'type': 'text'
|
||||||
'type': 'text'
|
}).up()
|
||||||
}).up()
|
.c('feature', {'var': 'http://jabber.org/protocol/muc'}).up()
|
||||||
.c('feature', {'var': 'http://jabber.org/protocol/muc'}).up()
|
.c('feature', {'var': 'jabber:iq:register'}).up()
|
||||||
.c('feature', {'var': 'jabber:iq:register'}).up()
|
.c('feature', {'var': 'muc_passwordprotected'}).up()
|
||||||
.c('feature', {'var': 'muc_passwordprotected'}).up()
|
.c('feature', {'var': 'muc_hidden'}).up()
|
||||||
.c('feature', {'var': 'muc_hidden'}).up()
|
.c('feature', {'var': 'muc_temporary'}).up()
|
||||||
.c('feature', {'var': 'muc_temporary'}).up()
|
.c('feature', {'var': 'muc_open'}).up()
|
||||||
.c('feature', {'var': 'muc_open'}).up()
|
.c('feature', {'var': 'muc_unmoderated'}).up()
|
||||||
.c('feature', {'var': 'muc_unmoderated'}).up()
|
.c('feature', {'var': 'muc_nonanonymous'})
|
||||||
.c('feature', {'var': 'muc_nonanonymous'})
|
.c('x', { 'xmlns':'jabber:x:data', 'type':'result'})
|
||||||
.c('x', { 'xmlns':'jabber:x:data', 'type':'result'})
|
.c('field', {'var':'FORM_TYPE', 'type':'hidden'})
|
||||||
.c('field', {'var':'FORM_TYPE', 'type':'hidden'})
|
.c('value').t('http://jabber.org/protocol/muc#roominfo').up().up()
|
||||||
.c('value').t('http://jabber.org/protocol/muc#roominfo').up().up()
|
.c('field', {'type':'text-single', 'var':'muc#roominfo_description', 'label':'Description'})
|
||||||
.c('field', {'type':'text-single', 'var':'muc#roominfo_description', 'label':'Description'})
|
.c('value').t('This is the description').up().up()
|
||||||
.c('value').t('This is the description').up().up()
|
.c('field', {'type':'text-single', 'var':'muc#roominfo_occupants', 'label':'Number of occupants'})
|
||||||
.c('field', {'type':'text-single', 'var':'muc#roominfo_occupants', 'label':'Number of occupants'})
|
.c('value').t(0);
|
||||||
.c('value').t(0);
|
_converse.connection._dataRecv(utils.createRequest(features_stanza));
|
||||||
_converse.connection._dataRecv(utils.createRequest(features_stanza));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return utils.waitUntil(() => _.filter(
|
return utils.waitUntil(() => _.filter(
|
||||||
stanzas,
|
stanzas,
|
||||||
s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s.nodeTree).length
|
s => sizzle(`iq[to="${room_jid}"] query[node="x-roomuser-item"]`, s.nodeTree).length
|
||||||
|
Loading…
Reference in New Issue
Block a user