@ -649,19 +649,25 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
$rootScope . $on ( 'activeBufferChanged' , function ( ) {
$rootScope . $on ( 'activeBufferChanged' , function ( ) {
var ab = models . getActiveBuffer ( ) ;
var ab = models . getActiveBuffer ( ) ;
if ( ab . isNicklistEmpty ( ) ) {
var bufferId = '0x' + ab . id ; // WeeChat needs the 0x prefix
connection . requestNicklist ( bufferId , function ( ) {
$scope . showNicklist = $scope . updateShowNicklist ( ) ;
} ) ;
}
if ( ab . requestedLines < $scope . lines ) {
if ( ab . requestedLines < $scope . lines ) {
// buffer has not been loaded, but some lines may already be present if they arrived after we connected
// buffer has not been loaded, but some lines may already be present if they arrived after we connected
$scope . fetchMoreLines ( $scope . lines ) ;
$scope . fetchMoreLines ( $scope . lines ) ;
}
}
$rootScope . updateTitle ( ab ) ;
$rootScope . updateTitle ( ab ) ;
// Send a request for the nicklist if it hasn't been loaded yet
if ( ! ab . nicklistRequested ( ) ) {
var bufferId = '0x' + ab . id ; // WeeChat needs the 0x prefix
connection . requestNicklist ( bufferId , function ( ) {
$scope . showNicklist = $scope . updateShowNicklist ( ) ;
// Scroll after nicklist has been loaded, as it may break long lines
$rootScope . scrollWithBuffer ( true ) ;
} ) ;
} else {
// Check if we should show nicklist or not
$scope . showNicklist = $scope . updateShowNicklist ( ) ;
}
$rootScope . scrollWithBuffer ( true ) ;
$rootScope . scrollWithBuffer ( true ) ;
// If user wants to sync hotlist with weechat
// If user wants to sync hotlist with weechat
@ -675,9 +681,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout',
// Clear search term on buffer change
// Clear search term on buffer change
$scope . search = '' ;
$scope . search = '' ;
// Check if we should show nicklist or not
$scope . showNicklist = $scope . updateShowNicklist ( ) ;
if ( ! $rootScope . isMobileDevice ( ) ) {
if ( ! $rootScope . isMobileDevice ( ) ) {
$ ( '#sendMessage' ) . focus ( ) ;
$ ( '#sendMessage' ) . focus ( ) ;
}
}