From 99e0111ec44676b6a69d382799a827e0d7e518ea Mon Sep 17 00:00:00 2001 From: Darren Date: Fri, 31 Aug 2012 22:43:20 +0100 Subject: [PATCH] Auto-joining to specificed channel --- client_backbone/model_application.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/client_backbone/model_application.js b/client_backbone/model_application.js index b53e192..80c1521 100644 --- a/client_backbone/model_application.js +++ b/client_backbone/model_application.js @@ -1,6 +1,9 @@ kiwi.model.Application = Backbone.Model.extend(new (function () { var that = this; + // The auto connect details entered into the server select box + var auto_connect_details = {}; + /** Instance of kiwi.model.PanelList */ this.panels = null; @@ -18,10 +21,10 @@ kiwi.model.Application = Backbone.Model.extend(new (function () { this.panels.server.server_login.on('server_connect', function (event) { var form = this; + auto_connect_details = event; + kiwi.gateway.set('nick', event.nick); - kiwi.gateway.connect(event.server, 6667, false, false, function () { - that.view.barsShow(); - }); + kiwi.gateway.connect(event.server, 6667, false, false, function () {}); }); }; @@ -60,7 +63,13 @@ kiwi.model.Application = Backbone.Model.extend(new (function () { }); - gw.on('onconnect', function (event) {}); + gw.on('onconnect', function (event) { + that.view.barsShow(); + + if (auto_connect_details.channel) { + kiwi.gateway.join(auto_connect_details.channel); + } + }); gw.on('onjoin', function (event) { -- 2.25.1