function onDisconnect(event) {
+ this.set('connected', false);
+
$.each(this.panels.models, function (index, panel) {
if (!panel.isApplet()) {
panel.addMsg('', styleText('network_disconnected', {text: translateText('client_models_network_disconnected', [])}), 'action quit');
// Update our nick with what the network gave us
this.set('nick', event.nick);
+ this.set('connected', true);
+
// If this is a re-connection then we may have some channels to re-join
this.rejoinAllChannels();
_kiwi.app.view.$el.find('.panellist .active').removeClass('active');
panel.tab.addClass('active');
-
+
panel.tab.append('<span class="part fa fa-nonexistant"></span>');
},
// close server tab, then bring client back to homepage
if (panel.isChannel() && panel.get('members').models.length > 0) {
this.model.network.gateway.part(panel.get('name'));
+
} else if(panel.isServer()) {
- if(_kiwi.app.connections.length < 2) {
- var confirmed = confirm("Closing your final connection will redirect you back to the homepage. Is this OK?");
- if(confirmed) {
- this.model.network.gateway.quit("Leaving");
- _kiwi.app.connections.remove(this.model.network);
- _kiwi.app.startup_applet.view.show();
- }
- } else {
+ if (!this.model.network.get('connected') || confirm(translateText('disconnect_from_server'))) {
this.model.network.gateway.quit("Leaving");
_kiwi.app.connections.remove(this.model.network);
+ _kiwi.app.startup_applet.view.show();
}
+
} else {
panel.close();
}