diff --git a/js/glowingbear.js b/js/glowingbear.js index 3f442a3..2ce40e8 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -815,6 +815,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $scope.activeBuffer = models.getActiveBuffer; + $rootScope.connected = false; $rootScope.waseverconnected = false; $rootScope.models = models; @@ -898,8 +899,9 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', document.getElementById('content').setAttribute('sidebar-state', 'hidden'); } }; + // This also fires on page load $scope.$watch('autoconnect', function() { - if ($scope.autoconnect && !$rootScope.connected) { + if ($scope.autoconnect && !$rootScope.connected && !$rootScope.sslError && !$rootScope.securityError && !$rootScope.errorMessage) { $scope.connect(); } }); @@ -1283,10 +1285,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', $scope.favico.reset(); }; - if ($scope.autoconnect && !$rootScope.connected && !$rootScope.sslError && !$rootScope.securityError && !$rootScope.errorMessage) { - $scope.connect(); - } - }] );