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); fetchAndSetMUCDomain(view);
view.model.on('change:connected', _.partial(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 ************************/ /************************ END Event Handlers ************************/
} }
}); });

View File

@ -9,7 +9,6 @@
"form-utils", "form-utils",
"converse-core", "converse-core",
"emojione", "emojione",
"converse-chatview",
"converse-disco", "converse-disco",
"backbone.overview", "backbone.overview",
"backbone.orderedlistview", "backbone.orderedlistview",
@ -68,7 +67,7 @@
* *
* NB: These plugins need to have already been loaded via require.js. * NB: These plugins need to have already been loaded via require.js.
*/ */
dependencies: ["converse-controlbox", "converse-chatview"], dependencies: ["converse-controlbox"],
overrides: { overrides: {
// Overrides mentioned here will be picked up by converse.js's // Overrides mentioned here will be picked up by converse.js's
@ -1122,21 +1121,6 @@
_converse.emit('roomsAutoJoined'); _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 () { function disconnectChatRooms () {
/* When disconnecting, or reconnecting, mark all chat rooms as /* When disconnecting, or reconnecting, mark all chat rooms as
* disconnected, so that they will be properly entered again * disconnected, so that they will be properly entered again
@ -1167,7 +1151,6 @@
} }
}); });
_converse.on('chatBoxesFetched', autoJoinRooms); _converse.on('chatBoxesFetched', autoJoinRooms);
_converse.on('reconnected', reconnectToChatRooms);
_converse.on('reconnecting', disconnectChatRooms); _converse.on('reconnecting', disconnectChatRooms);
_converse.on('disconnecting', disconnectChatRooms); _converse.on('disconnecting', disconnectChatRooms);
/************************ END Event Handlers ************************/ /************************ END Event Handlers ************************/