|
@@ -85,7 +85,7 @@ converse.plugins.add('converse-muc', {
|
|
|
const { _converse } = this.__super__,
|
|
|
groupchats = this.chatboxes.where({'type': _converse.CHATROOMS_TYPE});
|
|
|
|
|
|
- _.each(groupchats, gc => u.safeSave(gc, {'connection_status': converse.ROOMSTATUS.DISCONNECTED}));
|
|
|
+ _.each(groupchats, gc => u.safeSave(gc, {'connection_status': converse.ROOMSTATUS.DISCONNECTED}, {'patch': true}));
|
|
|
this.__super__.tearDown.call(this, arguments);
|
|
|
},
|
|
|
|
|
@@ -296,7 +296,7 @@ converse.plugins.add('converse-muc', {
|
|
|
if (password) {
|
|
|
stanza.cnode(Strophe.xmlElement("password", [], password));
|
|
|
}
|
|
|
- this.save('connection_status', converse.ROOMSTATUS.CONNECTING);
|
|
|
+ this.save({'connection_status': converse.ROOMSTATUS.CONNECTING}, {'patch': true});
|
|
|
_converse.api.send(stanza);
|
|
|
return this;
|
|
|
},
|
|
@@ -320,7 +320,7 @@ converse.plugins.add('converse-muc', {
|
|
|
if (_converse.connection.connected) {
|
|
|
this.sendUnavailablePresence(exit_msg);
|
|
|
}
|
|
|
- u.safeSave(this, {'connection_status': converse.ROOMSTATUS.DISCONNECTED});
|
|
|
+ u.safeSave(this, {'connection_status': converse.ROOMSTATUS.DISCONNECTED}, {'patch': true});
|
|
|
this.removeHandlers();
|
|
|
},
|
|
|
|
|
@@ -427,7 +427,7 @@ converse.plugins.add('converse-muc', {
|
|
|
* For example: groupchat@conference.example.org/nickname
|
|
|
*/
|
|
|
if (nick) {
|
|
|
- this.save({'nick': nick});
|
|
|
+ this.save({'nick': nick}, {'patch': true});
|
|
|
} else {
|
|
|
nick = this.get('nick');
|
|
|
}
|
|
@@ -531,7 +531,8 @@ converse.plugins.add('converse-muc', {
|
|
|
}
|
|
|
attrs[fieldname.replace('muc_', '')] = true;
|
|
|
});
|
|
|
- this.features.save(attrs);
|
|
|
+ attrs.description = _.get(fields.findWhere({'var': "muc#roominfo_description"}), 'attributes.value');
|
|
|
+ this.features.save(attrs, {'patch': true});
|
|
|
},
|
|
|
|
|
|
requestMemberList (affiliation) {
|
|
@@ -694,14 +695,10 @@ converse.plugins.add('converse-muc', {
|
|
|
const affiliation = item.getAttribute('affiliation');
|
|
|
const role = item.getAttribute('role');
|
|
|
if (affiliation) {
|
|
|
- this.save(
|
|
|
- {'affiliation': affiliation},
|
|
|
- {'wait': true, 'patch': true});
|
|
|
+ this.save({'affiliation': affiliation}, {'patch': true});
|
|
|
}
|
|
|
if (role) {
|
|
|
- this.save(
|
|
|
- {'role': role},
|
|
|
- {'wait': true, 'patch': true});
|
|
|
+ this.save({'role': role}, {'patch': true});
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -822,7 +819,7 @@ converse.plugins.add('converse-muc', {
|
|
|
this.save({
|
|
|
'reserved_nick': nick,
|
|
|
'nick': nick
|
|
|
- }, {'silent': true});
|
|
|
+ }, {'patch': true, 'silent': true});
|
|
|
return iq;
|
|
|
},
|
|
|
|
|
@@ -1063,37 +1060,34 @@ converse.plugins.add('converse-muc', {
|
|
|
const msg = this.messages.create(attrs);
|
|
|
this.incrementUnreadMsgCounter(msg);
|
|
|
if (forwarded && msg && msg.get('sender') === 'me') {
|
|
|
- msg.save({'received': moment().format()});
|
|
|
+ msg.save({'received': moment().format()}, {'patch': true});
|
|
|
}
|
|
|
}
|
|
|
_converse.emit('message', {'stanza': original_stanza, 'chatbox': this});
|
|
|
},
|
|
|
|
|
|
- async onPresence (pres) {
|
|
|
+ onPresence (pres) {
|
|
|
/* Handles all MUC presence stanzas.
|
|
|
*
|
|
|
* Parameters:
|
|
|
* (XMLElement) pres: The stanza
|
|
|
*/
|
|
|
if (pres.getAttribute('type') === 'error') {
|
|
|
- this.save('connection_status', converse.ROOMSTATUS.DISCONNECTED);
|
|
|
+ this.save({'connection_status': converse.ROOMSTATUS.DISCONNECTED}, {'patch': true});
|
|
|
return;
|
|
|
}
|
|
|
const is_self = pres.querySelector("status[code='110']");
|
|
|
if (is_self && pres.getAttribute('type') !== 'unavailable') {
|
|
|
- await this.onOwnPresence(pres);
|
|
|
+ this.onOwnPresence(pres);
|
|
|
}
|
|
|
this.updateOccupantsOnPresence(pres);
|
|
|
|
|
|
if (this.get('role') !== 'none' && this.get('connection_status') === converse.ROOMSTATUS.CONNECTING) {
|
|
|
- await new Promise((success, error) => this.save(
|
|
|
- {'connection_status': converse.ROOMSTATUS.CONNECTED},
|
|
|
- {'patch': true, 'wait': true, success, error}
|
|
|
- ));
|
|
|
+ this.save({'connection_status': converse.ROOMSTATUS.CONNECTED}, {'patch': true});
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- async onOwnPresence (pres) {
|
|
|
+ onOwnPresence (pres) {
|
|
|
/* Handles a received presence relating to the current
|
|
|
* user.
|
|
|
*
|
|
@@ -1134,10 +1128,7 @@ converse.plugins.add('converse-muc', {
|
|
|
this.getRoomFeatures();
|
|
|
}
|
|
|
}
|
|
|
- await new Promise((success, error) => this.save(
|
|
|
- {'connection_status': converse.ROOMSTATUS.ENTERED},
|
|
|
- {'patch': true, 'wait': true, success, error}
|
|
|
- ));
|
|
|
+ this.save({'connection_status': converse.ROOMSTATUS.ENTERED}, {'patch': true});
|
|
|
},
|
|
|
|
|
|
isUserMentioned (message) {
|
|
@@ -1180,7 +1171,7 @@ converse.plugins.add('converse-muc', {
|
|
|
u.safeSave(this, {
|
|
|
'num_unread': 0,
|
|
|
'num_unread_general': 0
|
|
|
- });
|
|
|
+ }, {'patch': true});
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -1398,7 +1389,7 @@ converse.plugins.add('converse-muc', {
|
|
|
*/
|
|
|
_converse.chatboxes.each(function (model) {
|
|
|
if (model.get('type') === _converse.CHATROOMS_TYPE) {
|
|
|
- model.save('connection_status', converse.ROOMSTATUS.DISCONNECTED);
|
|
|
+ model.save({'connection_status': converse.ROOMSTATUS.DISCONNECTED}, {'patch': true});
|
|
|
}
|
|
|
});
|
|
|
}
|