Changeset 4813

Show
Ignore:
Timestamp:
05/31/07 17:46:32 (1 year ago)
Author:
morris
Message:

Add real support for auto-reconnecting, without preference GUI for now

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/English.lproj/Localizable.strings

    r4799 r4813  
    7070"%@: %@" = "%1$@: %2$@"; 
    7171 
    72 /* Search info (items, 'item(s)', total) */ 
    73 "%lu %@, %@ total" = "%1$lu %2$@, %3$@ total"; 
    74  
    75 /* Files info (count, 'item(s)', size, available) */ 
    76 "%lu %@, %@ total, %@ available" = "%1$lu %2$@, %3$@ total, %4$@ available"; 
    77  
    78 /* Accounts status (users, 'user(s)', groups, 'group(s)') */ 
    79 "%lu %@, %lu %@" = "%1$lu %2$@, %3$lu %4$@"; 
    80  
    8172/* File info folder size (count, 'item(s)' 
    8273   Files folder size (count, 'item(s)' */ 
     
    8576/* Dock status (connections, 'connection(s)') */ 
    8677"%lu %@" = "%1$lu %2$@"; 
     78 
     79/* Search info (items, 'item(s)', total) */ 
     80"%lu %@, %@ total" = "%1$lu %2$@, %3$@ total"; 
     81 
     82/* Files info (count, 'item(s)', size, available) */ 
     83"%lu %@, %@ total, %@ available" = "%1$lu %2$@, %3$@ total, %4$@ available"; 
     84 
     85/* Accounts status (users, 'user(s)', groups, 'group(s)') */ 
     86"%lu %@, %lu %@" = "%1$lu %2$@, %3$lu %4$@"; 
    8787 
    8888/* Transfer status (files, transferred, size, speed, time) */ 
     
    191191"Chat" = "Chat"; 
    192192 
    193 /* Event */ 
    194 "Chat Received" = "Chat Received"; 
    195  
    196193/* Growl event chat received title */ 
    197194"Chat received" = "Chat received"; 
     195 
     196/* Event */ 
     197"Chat Received" = "Chat Received"; 
    198198 
    199199/* Error 
     
    358358"General" = "General"; 
    359359 
     360/* Account type */ 
     361"Group" = "Group"; 
     362 
    360363/* Group singular */ 
    361364"group" = "group"; 
    362  
    363 /* Account type */ 
    364 "Group" = "Group"; 
    365365 
    366366/* Group plural */ 
     
    422422"message" = "message"; 
    423423 
     424/* Event */ 
     425"Message Received" = "Message Received"; 
     426 
    424427/* Growl event message received title */ 
    425428"Message received" = "Message received"; 
    426  
    427 /* Event */ 
    428 "Message Received" = "Message Received"; 
    429429 
    430430/* Message plural */ 
     
    442442"News" = "News"; 
    443443 
     444/* Event */ 
     445"News Posted" = "News Posted"; 
     446 
    444447/* Growl event news posted title */ 
    445448"News posted" = "News posted"; 
    446  
    447 /* Event */ 
    448 "News Posted" = "News Posted"; 
    449449 
    450450/* 'No' */ 
     
    486486"Queued at position %lu" = "Queued at position %lu"; 
    487487 
    488 /* Disconnected chat message */ 
    489 "Re-established connection to %@" = "Re-established connection to %@"; 
    490  
    491488/* Ping received message (interval) */ 
    492489"Received ping reply after %.2fms" = "Received ping reply after %.2fms"; 
     
    494491/* Disconnect toolbar item */ 
    495492"Reconnect" = "Reconnect"; 
     493 
     494/* Reconnected chat message */ 
     495"Reconnected to %@" = "Reconnected to %@"; 
     496 
     497/* Auto-reconnecting chat message */ 
     498"Reconnecting to %@ in %.1f seconds..." = "Reconnecting to %1$@ in %2$.1f seconds..."; 
    496499 
    497500/* Restore all layouts to default dialog title */ 
     
    637640"Transfer Failed" = "Transfer Failed"; 
    638641 
    639 /* Event */ 
    640 "Transfer Finished" = "Transfer Finished"; 
    641  
    642642/* Growl event transfer started title */ 
    643643"Transfer finished" = "Transfer finished"; 
     644 
     645/* Event */ 
     646"Transfer Finished" = "Transfer Finished"; 
    644647 
    645648/* Error */ 
     
    674677"Uploads Folder" = "Uploads Folder"; 
    675678 
     679/* User singular */ 
     680"user" = "user"; 
     681 
    676682/* Account type */ 
    677683"User" = "User"; 
    678684 
    679 /* User singular */ 
    680 "user" = "user"; 
    681  
    682685/* Growl event user changed nick title */ 
    683686"User changed nick" = "User changed nick"; 
     
    686689"User Changed Nick" = "User Changed Nick"; 
    687690 
     691/* Event */ 
     692"User Changed Status" = "User Changed Status"; 
     693 
    688694/* Growl event user changed status title */ 
    689695"User changed status" = "User changed status"; 
    690696 
    691697/* Event */ 
    692 "User Changed Status" = "User Changed Status"; 
    693  
    694 /* Event */ 
    695698"User Joined" = "User Joined"; 
    696699 
  • WiredClient/trunk/French.lproj/Localizable.strings

    r4799 r4813  
    461461"Queued at position %lu" = "En attente à la position %lu"; 
    462462 
    463 /* Disconnected chat message */ 
    464 "Re-established connection to %@" = "Ré-établir la connexion avec %@"; 
    465  
    466463/* Ping received message (interval) */ 
    467464"Received ping reply after %.2fms" = "Réception d’une réponse de \"ping\" après %.2fms"; 
     
    469466/* Disconnect toolbar item */ 
    470467"Reconnect" = "Reconnecter"; 
     468 
     469/* Reconnected chat message */ 
     470"Reconnected to %@" = "Reconnected to %@"; 
     471 
     472/* Auto-reconnecting chat message */ 
     473"Reconnecting to %@ in %.1f seconds..." = "Reconnecting to %1$@ in %2$.1f seconds..."; 
    471474 
    472475/* Restore all layouts to default dialog title */ 
  • WiredClient/trunk/German.lproj/Localizable.strings

    r4799 r4813  
    486486"Queued at position %lu" = "Wartend an Stelle %lu"; 
    487487 
    488 /* Disconnected chat message */ 
    489 "Re-established connection to %@" = "Verbindung zu %@ wiederhergestellt"; 
    490  
    491488/* Ping received message (interval) */ 
    492489"Received ping reply after %.2fms" = "Ping-Antwort erhalten nach %.2fms"; 
     
    494491/* Disconnect toolbar item */ 
    495492"Reconnect" = "Wieder verbinden"; 
     493 
     494/* Reconnected chat message */ 
     495"Reconnected to %@" = "Reconnected to %@"; 
     496 
     497/* Auto-reconnecting chat message */ 
     498"Reconnecting to %@ in %.1f seconds..." = "Reconnecting to %1$@ in %2$.1f seconds..."; 
    496499 
    497500/* Restore all layouts to default dialog title */ 
  • WiredClient/trunk/Japanese.lproj/Localizable.strings

    r4799 r4813  
    489489"Queued at position %lu" = "%lu 番目のキューに入っています"; 
    490490 
    491 /* Disconnected chat message */ 
    492 "Re-established connection to %@" = "%@ さんとの接続が再開されました"; 
    493  
    494491/* Ping received message (interval) */ 
    495492"Received ping reply after %.2fms" = "%.2fms 後に ping 応答を受信しました"; 
     
    497494/* Disconnect toolbar item */ 
    498495"Reconnect" = "接続し直す"; 
     496 
     497/* Reconnected chat message */ 
     498"Reconnected to %@" = "Reconnected to %@"; 
     499 
     500/* Auto-reconnecting chat message */ 
     501"Reconnecting to %@ in %.1f seconds..." = "Reconnecting to %1$@ in %2$.1f seconds..."; 
    499502 
    500503/* Restore all layouts to default dialog title */ 
  • WiredClient/trunk/WCConnectionController.m

    r4799 r4813  
    192192        } 
    193193         
    194         if([self respondsToSelector:@selector(serverConnectionWillAutoReconnect:)]) { 
    195                 [[self connection] addObserver:self 
    196                                                           selector:@selector(serverConnectionWillAutoReconnect:) 
    197                                                                   name:WCServerConnectionWillAutoReconnect]; 
    198         } 
    199  
    200194        if([self respondsToSelector:@selector(serverConnectionServerInfoDidChange:)]) { 
    201195                [_connection addObserver:self 
  • WiredClient/trunk/WCPublicChat.m

    r4799 r4813  
    308308                error = [WCError errorWithDomain:WCWiredClientErrorDomain code:WCWiredClientServerDisconnected]; 
    309309         
    310         if([[self connection] isAutoReconnecting]) { 
    311                 [self printEvent:[error localizedFailureReason]]; 
    312         } 
    313         else if(![[self connection] isReconnecting]) { 
     310        if(![[self connection] isReconnecting]) { 
    314311                if([[self window] isMiniaturized]) 
    315312                        [self showWindow:self]; 
    316313                 
    317314                if([[self window] isVisible]) { 
    318                         if(!YES) { 
     315                        if(![WCSettings boolForKey:WCAutoReconnect]) { 
    319316                                if(![[self connection] isDisconnecting]) { 
    320317                                        [[self connection] triggerEvent:WCEventsError info1:error]; 
     
    322319                                } 
    323320                        } 
    324                          
    325                         [self printEvent:[NSSWF:NSLS(@"Lost connection to %@", @"Disconnected chat message"), 
    326                                 [[self connection] name]]]; 
    327321                } 
    328322        } 
     
    339333         
    340334        [super connectionWillTerminate:notification]; 
    341 } 
    342  
    343  
    344  
    345 - (void)serverConnectionWillAutoReconnect:(NSNotification *)notification { 
    346         [self printEvent:[NSSWF:NSLS(@"Automatically reconnecting to %@ in %.1f seconds", @"Auto-reconnecting chat message"), 
    347                 [[self connection] name], 5.0]]; 
    348335} 
    349336 
     
    375362        [item setToolTip:[[self connection] name]]; 
    376363         
    377         if([[self connection] isReconnecting]) { 
     364        if([[self connection] isReconnecting]) 
    378365                [[_toolbarItems objectForKey:@"Banner"] setImage:[NSImage imageNamed:@"Banner"]]; 
    379  
    380                 [self printEvent:[NSSWF:NSLS(@"Re-established connection to %@", @"Disconnected chat message"), [[self connection] name]]]; 
    381         } 
    382366 
    383367        [super serverConnectionServerInfoDidChange:notification]; 
  • WiredClient/trunk/WCServerConnection.h

    r4799 r4813  
    7171        BOOL                                                                                    _disconnecting; 
    7272        BOOL                                                                                    _reconnecting; 
    73         BOOL                                                                                    _shouldReconnect; 
    7473        BOOL                                                                                    _autoReconnecting; 
    7574        BOOL                                                                                    _hidden; 
     
    7978 
    8079#define WCServerConnectionWillReconnect                         @"WCServerConnectionWillReconnect" 
    81 #define WCServerConnectionWillAutoReconnect                     @"WCServerConnectionWillAutoReconnect" 
    8280#define WCServerConnectionShouldHide                            @"WCServerConnectionShouldHide" 
    8381#define WCServerConnectionShouldUnhide                          @"WCServerConnectionShouldUnhide" 
  • WiredClient/trunk/WCServerConnection.m

    r4801 r4813  
    234234 
    235235- (void)_autoReconnect { 
    236 #if 0 
    237         if(_shouldReconnect) { 
    238                 _autoReconnecting = YES; 
    239                  
    240                 [self postNotificationName:WCServerConnectionWillReconnect object:self]; 
    241  
    242                 [self showWindow:self]; 
    243                  
    244                 [self connect]; 
    245         } 
    246 #endif 
     236        _autoReconnecting = YES; 
     237         
     238        [self postNotificationName:WCServerConnectionWillReconnect object:self]; 
     239 
     240        [self showWindow:self]; 
     241         
     242        [self connect]; 
    247243} 
    248244 
     
    411407 
    412408- (void)connectionDidTerminate:(NSNotification *)notification { 
     409        [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(_autoReconnect) object:NULL]; 
     410         
    413411        [_progressIndicator stopAnimation:self]; 
    414412 
     
    423421- (void)connectionDidClose:(NSNotification *)notification { 
    424422        WCError         *error; 
     423        float           time; 
    425424         
    426425        [_progressIndicator stopAnimation:self]; 
     
    434433                } else { 
    435434                        error = [[notification userInfo] objectForKey:WCErrorKey]; 
     435                         
     436                        if(!error) 
     437                                error = [WCError errorWithDomain:WCWiredClientErrorDomain code:WCWiredClientServerDisconnected]; 
    436438                         
    437439                        if(error) { 
     
    445447                        } 
    446448                         
    447                         if(![[self window] isVisible]) 
     449                        if(![[self window] isVisible]) { 
    448450                                [self triggerEvent:WCEventsServerDisconnected]; 
     451                         
     452                                [[self chat] printEvent:[NSSWF:NSLS(@"Lost connection to %@", @"Disconnected chat message"), 
     453                                        [self name]]]; 
     454                        } 
    449455                } 
    450456                 
    451 #if 0 
    452                 if(YES && _userID > 0 && !_kicked) { 
    453                         _shouldReconnect = YES; 
    454  
    455                         [self postNotificationName:WCServerConnectionWillAutoReconnect object:self]; 
    456          
    457                         [self performSelector:@selector(_autoReconnect) afterDelay:5.0]; 
     457                if([WCSettings boolForKey:WCAutoReconnect] && _userID > 0 && !_kicked && !_disconnecting) { 
     458                       time = [WCSettings floatForKey:WCAutoReconnectTime]; 
     459 
     460                        [[self chat] printEvent:[NSSWF:NSLS(@"Reconnecting to %@ in %.1f seconds...", @"Auto-reconnecting chat message"), 
     461                               [self name], time]]; 
     462         
     463                        [self performSelector:@selector(_autoReconnect) afterDelay:time]; 
    458464                } 
    459 #endif 
    460465        } 
    461466         
     
    523528         
    524529        [[self window] setTitle:[self name] withSubtitle:NSLS(@"Connect", @"Connect window title")]; 
     530         
     531        if(_reconnecting) { 
     532 
     533                [[self chat] printEvent:[NSSWF:NSLS(@"Reconnected to %@", @"Reconnected chat message"), 
     534                        [self name]]]; 
     535        } 
    525536 
    526537        [self postNotificationName:WCServerConnectionServerInfoDidChange object:self]; 
     
    542553         
    543554        _reconnecting = NO; 
     555        _autoReconnecting = NO; 
    544556         
    545557        [self triggerEvent:WCEventsServerConnected]; 
     
    956968 
    957969- (void)reconnect { 
    958         _shouldReconnect = NO; 
     970        _autoReconnecting = NO; 
     971         
     972        [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(_autoReconnect) object:NULL]; 
    959973         
    960974        [self postNotificationName:WCServerConnectionWillReconnect object:self]; 
  • WiredClient/trunk/WCSettings.h

    r4799 r4813  
    4040#define WCPreventMultipleConnections                    @"WCPreventMultipleConnections" 
    4141#define WCConfirmDisconnect                                             @"WCConfirmDisconnect" 
     42#define WCAutoReconnect                                                 @"WCAutoReconnect" 
     43#define WCAutoReconnectTime                                             @"WCAutoReconnectTime" 
    4244 
    4345#define WCChatTextColor                                                 @"WCChatTextColor" 
  • WiredClient/trunk/WCSettings.m

    r4799 r4813  
    184184                @"Vy/xW31D+jfvNtPdS+ASBQAAAABJRU5ErkJggg==", 
    185185                        WCCustomIcon, 
     186                 
    186187                [NSNumber numberWithBool:YES], 
    187188                        WCShowConnectAtStartup, 
     
    190191                [NSNumber numberWithBool:NO], 
    191192                        WCShowTrackersAtStartup, 
     193                 
    192194                [NSNumber numberWithBool:NO], 
    193195                        WCAutoHideOnSwitch, 
     
    196198                [NSNumber numberWithBool:YES], 
    197199                        WCConfirmDisconnect, 
     200                [NSNumber numberWithBool:NO], 
     201                        WCAutoReconnect, 
     202                [NSNumber numberWithFloat:30.0], 
     203                        WCAutoReconnectTime, 
    198204                 
    199205                // --- interface/chat