Commit cb0d8c7d authored by JC Brand's avatar JC Brand

Found more MUC code that should be in the view module

parent 6f956284
...@@ -1815,6 +1815,21 @@ ...@@ -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 ************************/
} }
}); });
......
...@@ -9,7 +9,6 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 ************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment