Merge pull request #169 from cormier/fix-73

Reinitialize context when relay closes connection
This commit is contained in:
David Cormier 2014-02-21 09:47:04 -05:00
commit e468fe57f0
2 changed files with 14 additions and 0 deletions

View File

@ -378,6 +378,7 @@ function($rootScope,
$log.info("Disconnected from relay");
failCallbacks('disconnection');
$rootScope.connected = false;
$rootScope.$emit('relayDisconnect');
$rootScope.$apply();
};
@ -584,6 +585,11 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$scope.showSidebar = true;
$scope.buffers = models.model.buffers;
$rootScope.$on('relayDisconnect', function() {
models.reinitialize();
});
$scope.activeBuffer = models.getActiveBuffer;
$rootScope.waseverconnected = false;

View File

@ -425,6 +425,14 @@ models.service('models', ['$rootScope', '$filter', function($rootScope, $filter)
return BufferList;
};
/*
* Reinitializes the model
*/
this.reinitialize = function() {
BufferList = [];
this.model.buffers = {};
};
/*
* Returns a specific buffer object
*