Start handling error presences in MUC model

This commit is contained in:
JC Brand 2019-05-09 12:18:36 +02:00
parent 1be9958aa1
commit 145ee88213
3 changed files with 29 additions and 3 deletions

9
dist/converse.js vendored
View File

@ -60970,7 +60970,16 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
*/
onPresence(pres) {
if (pres.getAttribute('type') === 'error') {
// TODO: currently showErrorMessageFromPresence handles
// 'error" presences in converse-muc-views.
// Instead, they should be handled here and the presence
// handler removed from there.
if (sizzle(`error not-authorized[xmlns="${Strophe.NS.STANZAS}"]`, pres).length) {
this.save('connection_status', _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].ROOMSTATUS.PASSWORD_REQUIRED);
} else {
this.save('connection_status', _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].ROOMSTATUS.DISCONNECTED);
}
return;
}

View File

@ -1116,7 +1116,15 @@ converse.plugins.add('converse-muc', {
*/
onPresence (pres) {
if (pres.getAttribute('type') === 'error') {
// TODO: currently showErrorMessageFromPresence handles
// 'error" presences in converse-muc-views.
// Instead, they should be handled here and the presence
// handler removed from there.
if (sizzle(`error not-authorized[xmlns="${Strophe.NS.STANZAS}"]`, pres).length) {
this.save('connection_status', converse.ROOMSTATUS.PASSWORD_REQUIRED);
} else {
this.save('connection_status', converse.ROOMSTATUS.DISCONNECTED);
}
return;
}
const is_self = pres.querySelector("status[code='110']");

View File

@ -39257,7 +39257,16 @@ _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].plugins.add('converse-muc
*/
onPresence(pres) {
if (pres.getAttribute('type') === 'error') {
// TODO: currently showErrorMessageFromPresence handles
// 'error" presences in converse-muc-views.
// Instead, they should be handled here and the presence
// handler removed from there.
if (sizzle(`error not-authorized[xmlns="${Strophe.NS.STANZAS}"]`, pres).length) {
this.save('connection_status', _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].ROOMSTATUS.PASSWORD_REQUIRED);
} else {
this.save('connection_status', _converse_core__WEBPACK_IMPORTED_MODULE_3__["default"].ROOMSTATUS.DISCONNECTED);
}
return;
}