Found more MUC code that should be in the view module

This commit is contained in:
JC Brand 2018-05-02 15:29:06 +02:00
parent 6f95628420
commit cb0d8c7d86
2 changed files with 16 additions and 18 deletions

View File

@ -1815,6 +1815,21 @@
fetchAndSetMUCDomain(view);
view.model.on('change:connected', _.partial(fetchAndSetMUCDomain, view));
});
function reconnectToChatRooms () {
/* Upon a reconnection event from converse, join again
* all the open chat rooms.
*/
_converse.chatboxviews.each(function (view) {
if (view.model.get('type') === converse.CHATROOMS_TYPE) {
view.model.save('connection_status', converse.ROOMSTATUS.DISCONNECTED);
view.model.registerHandlers();
view.join();
view.fetchMessages();
}
});
}
_converse.on('reconnected', reconnectToChatRooms);
/************************ END Event Handlers ************************/
}
});

View File

@ -9,7 +9,6 @@
"form-utils",
"converse-core",
"emojione",
"converse-chatview",
"converse-disco",
"backbone.overview",
"backbone.orderedlistview",
@ -68,7 +67,7 @@
*
* NB: These plugins need to have already been loaded via require.js.
*/
dependencies: ["converse-controlbox", "converse-chatview"],
dependencies: ["converse-controlbox"],
overrides: {
// Overrides mentioned here will be picked up by converse.js's
@ -1122,21 +1121,6 @@
_converse.emit('roomsAutoJoined');
}
function reconnectToChatRooms () {
/* Upon a reconnection event from converse, join again
* all the open chat rooms.
*/
_converse.chatboxviews.each(function (view) {
if (view.model.get('type') === converse.CHATROOMS_TYPE) {
view.model.save('connection_status', converse.ROOMSTATUS.DISCONNECTED);
view.model.registerHandlers();
view.join();
view.fetchMessages();
}
});
}
function disconnectChatRooms () {
/* When disconnecting, or reconnecting, mark all chat rooms as
* disconnected, so that they will be properly entered again
@ -1167,7 +1151,6 @@
}
});
_converse.on('chatBoxesFetched', autoJoinRooms);
_converse.on('reconnected', reconnectToChatRooms);
_converse.on('reconnecting', disconnectChatRooms);
_converse.on('disconnecting', disconnectChatRooms);
/************************ END Event Handlers ************************/