Merge pull request #382 from glowing-bear/fixautoconnect

Prevent autoconnect from connecting twice
This commit is contained in:
David Cormier 2014-08-01 15:57:24 -04:00
commit 12a8726407

View file

@ -831,6 +831,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.activeBuffer = models.getActiveBuffer;
$rootScope.connected = false;
$rootScope.waseverconnected = false;
$rootScope.models = models;
@ -914,8 +915,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();
}
});
@ -1299,10 +1301,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.favico.reset();
};
if ($scope.autoconnect && !$rootScope.connected && !$rootScope.sslError && !$rootScope.securityError && !$rootScope.errorMessage) {
$scope.connect();
}
}]
);