Changeset 1317

Show
Ignore:
Timestamp:
05/23/04 09:24:21 (4 years ago)
Author:
morris
Message:

bring in a new method for handling server errors, it works like this:

all objects that send commands to the server must now use the sendCommand:withSender: constructs with "self" as sender

when a server error occurs and that object was the last one to send a command, that object's method -connectionShouldHandleServerError: is called, to allow any additional cleanup

for example, WCTransfer now use it to remove any offending WCTransfer from its listing, and WCFileInfo/WCUserInfo use it to silently remove themselves

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/WCAccountEditor.m

    r1298 r1317  
    1 /* $Id: WCAccountEditor.m,v 1.8 2004/05/22 02:18:09 morris Exp $ */ 
     1/* $Id: WCAccountEditor.m,v 1.9 2004/05/23 07:24:21 morris Exp $ */ 
    22 
    33/* 
     
    8686 
    8787        // --- send groups command 
    88         [_connection sendCommand:WCGroupsCommand]; 
     88        [_connection sendCommand:WCGroupsCommand withSender:self]; 
    8989 
    9090        // --- set up for edit or create 
     
    9999 
    100100                                // --- send read command 
    101                                 [_connection sendCommand:WCReadUserCommand withArgument:[_account name]]; 
     101                                [_connection sendCommand:WCReadUserCommand 
     102                                                        withArgument:[_account name] 
     103                                                          withSender:self]; 
    102104                                break; 
    103105                         
     
    108110                                 
    109111                                // --- send read command 
    110                                 [_connection sendCommand:WCReadGroupCommand withArgument:[_account name]]; 
     112                                [_connection sendCommand:WCReadGroupCommand 
     113                                                        withArgument:[_account name] 
     114                                                          withSender:self]; 
    111115                                break; 
    112116                } 
     
    412416        // --- send create account command 
    413417        if([_typePopUpButton selectedItem] == _userMenuItem) { 
    414                 [_connection sendCommand:WCCreateUserCommand withArgument:[NSString stringWithFormat: 
     418                [_connection sendCommand:WCCreateUserCommand 
     419                                        withArgument:[NSString stringWithFormat: 
    415420                                @"%@%@%@%@%@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
    416421                        [_nameTextField stringValue], 
     
    458463                        [_downloadSpeedTextField intValue] * 1024, 
    459464                        WCFieldSeparator, 
    460                         [_uploadSpeedTextField intValue] * 1024]]; 
     465                        [_uploadSpeedTextField intValue] * 1024] 
     466                                          withSender:self]; 
    461467        } 
    462468        else if([_typePopUpButton selectedItem] == _groupMenuItem) { 
    463                 [_connection sendCommand:WCCreateGroupCommand withArgument:[NSString stringWithFormat: 
     469                [_connection sendCommand:WCCreateGroupCommand 
     470                                        withArgument:[NSString stringWithFormat: 
    464471                        @"%@ %@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
    465472                        [_nameTextField stringValue], 
     
    503510                        [_downloadSpeedTextField intValue] * 1024, 
    504511                        WCFieldSeparator, 
    505                         [_uploadSpeedTextField intValue] * 1024]]; 
     512                        [_uploadSpeedTextField intValue] * 1024] 
     513                                          withSender:self]; 
    506514        } 
    507515         
     
    545553        // --- send edit account command 
    546554        if([_account type] == WCAccountTypeUser) { 
    547                 [_connection sendCommand:WCEditUserCommand withArgument:[NSString stringWithFormat: 
     555                [_connection sendCommand:WCEditUserCommand 
     556                                        withArgument:[NSString stringWithFormat: 
    548557                        @"%@%@%@%@%@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
    549558                        [_nameTextField stringValue], 
     
    591600                        [_downloadSpeedTextField intValue] * 1024, 
    592601                        WCFieldSeparator, 
    593                         [_uploadSpeedTextField intValue] * 1024]]; 
     602                        [_uploadSpeedTextField intValue] * 1024] 
     603                                          withSender:self]; 
    594604        } else { 
    595                 [_connection sendCommand:WCEditGroupCommand withArgument:[NSString stringWithFormat: 
     605                [_connection sendCommand:WCEditGroupCommand 
     606                                        withArgument:[NSString stringWithFormat: 
    596607                        @"%@ %@%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u%@%u", 
    597608                        [_nameTextField stringValue], 
     
    635646                        [_downloadSpeedTextField intValue] * 1024, 
    636647                        WCFieldSeparator, 
    637                         [_uploadSpeedTextField intValue] * 1024]]; 
     648                        [_uploadSpeedTextField intValue] * 1024] 
     649                                          withSender:self]; 
    638650        } 
    639651 
     
    779791                // --- send read group command 
    780792                [_connection sendCommand:WCReadGroupCommand 
    781                                         withArgument:[[_groupPopUpButton selectedItem] title]]; 
     793                                        withArgument:[[_groupPopUpButton selectedItem] title] 
     794                                          withSender:self]; 
    782795                 
    783796                // --- disable buttons 
  • WiredClient/trunk/WCAccounts.m

    r1298 r1317  
    1 /* $Id: WCAccounts.m,v 1.14 2004/05/22 02:18:09 morris Exp $ */ 
     1/* $Id: WCAccounts.m,v 1.15 2004/05/23 07:24:21 morris Exp $ */ 
    22 
    33/* 
     
    365365                 
    366366                // --- send delete command 
    367                 [_connection sendCommand:command withArgument:[account name]]; 
     367                [_connection sendCommand:command withArgument:[account name] withSender:self]; 
    368368                 
    369369                // --- reload listing 
     
    541541 
    542542        // --- send the list commands 
    543         [_connection sendCommand:WCUsersCommand]; 
    544         [_connection sendCommand:WCGroupsCommand]; 
     543        [_connection sendCommand:WCUsersCommand withSender:self]; 
     544        [_connection sendCommand:WCGroupsCommand withSender:self]; 
    545545} 
    546546 
  • WiredClient/trunk/WCChat.m

    r1316 r1317  
    1 /* $Id: WCChat.m,v 1.47 2004/05/23 03:29:02 morris Exp $ */ 
     1/* $Id: WCChat.m,v 1.48 2004/05/23 07:24:21 morris Exp $ */ 
    22 
    33/* 
     
    995995                                                        [_connection sendCommand:WCMeCommand 
    996996                                                                                withArgument:[NSString stringWithFormat:@"%u", _cid] 
    997                                                                                 withArgument:line]; 
     997                                                                                withArgument:line 
     998                                                                                  withSender:self]; 
    998999                                                } else { 
    9991000                                                        [_connection sendCommand:WCSayCommand 
    10001001                                                                                withArgument:[NSString stringWithFormat:@"%u", _cid] 
    1001                                                                                 withArgument:line]; 
     1002                                                                                withArgument:line 
     1003                                                                                  withSender:self]; 
    10021004                                                } 
    10031005                                        } 
     
    13221324                [_connection sendCommand:WCMeCommand 
    13231325                                        withArgument:[NSString stringWithFormat:@"%u", _cid] 
    1324                                         withArgument:argument]; 
     1326                                        withArgument:argument 
     1327                                          withSender:self]; 
    13251328                 
    13261329                // --- save in stats 
     
    13781381                                        [_connection sendCommand:WCSayCommand 
    13791382                                                                withArgument:[NSString stringWithFormat:@"%u", _cid] 
    1380                                                                 withArgument:each]; 
     1383                                                                withArgument:each 
     1384                                                                  withSender:self]; 
    13811385                                } 
    13821386                        } 
     
    13911395        else if(([command isEqualToString:@"/nick"] || 
    13921396                         [command isEqualToString:@"/n"]) && [argument length] > 0) { 
    1393                 [_connection sendCommand:WCNickCommand withArgument:argument]; 
     1397                [_connection sendCommand:WCNickCommand withArgument:argument withSender:self]; 
    13941398                 
    13951399                return YES; 
     
    13991403                        [_connection sendCommand:WCIconCommand 
    14001404                                                withArgument:argument 
    1401                                                 withArgument:@""]; 
     1405                                                withArgument:@"" 
     1406                                                  withSender:self]; 
    14021407                } else { 
    1403                         [_connection sendCommand:WCIconCommand withArgument:argument]; 
     1408                        [_connection sendCommand:WCIconCommand withArgument:argument withSender:self]; 
    14041409                } 
    14051410                 
     
    14081413        else if(([command isEqualToString:@"/status"] || 
    14091414                         [command isEqualToString:@"/s"]) && [argument length] > 0) { 
    1410                 [_connection sendCommand:WCStatusCommand withArgument:argument]; 
     1415                [_connection sendCommand:WCStatusCommand withArgument:argument withSender:self]; 
    14111416                 
    14121417                return YES; 
     
    14151420                [_connection sendCommand:WCIconCommand 
    14161421                                        withArgument:[NSString stringWithFormat:@"%u", _cid] 
    1417                                         withArgument:[WCStats stats]]; 
     1422                                        withArgument:[WCStats stats] 
     1423                                          withSender:self]; 
    14181424                 
    14191425                return YES; 
     
    14421448                [_connection sendCommand:WCIconCommand 
    14431449                                        withArgument:[NSString stringWithFormat:@"%u", uid] 
    1444                                         withArgument:argument]; 
     1450                                        withArgument:argument 
     1451                                          withSender:self]; 
    14451452                 
    14461453                return YES; 
  • WiredClient/trunk/WCConnection.h

    r1302 r1317  
    1 /* $Id: WCConnection.h,v 1.9 2004/05/22 08:06:59 morris Exp $ */ 
     1/* $Id: WCConnection.h,v 1.10 2004/05/23 07:24:21 morris Exp $ */ 
    22 
    33/* 
     
    2727 */ 
    2828 
     29@protocol WCConnectionErrorHandling 
     30 
     31- (void)                                                connectionShouldHandleError:(int)error; 
     32 
     33@end 
     34 
     35 
    2936@class WCAccounts, WCPublicChat, WCConsole, WCError, WCMessages, WCAccount; 
    3037@class WCNews, WCSearch, WCSecureSocket, WCToolbar, WCTransfers, WCServer; 
    3138@class WCCache, WCServerInfo, WCTracker; 
     39 
    3240 
    3341@interface WCConnection : NSObject { 
     
    4856        WCTracker                                       *_tracker; 
    4957         
     58        id                                                      _sender; 
    5059        NSTimer                                         *_timer; 
    5160        unsigned int                            _type; 
     
    121130#define                                                 WCConnectionShouldTerminate                     @"WCConnectionShouldTerminate" 
    122131#define                                                 WCConnectionShouldCancel                        @"WCConnectionShouldCancel" 
    123 #define                                                 WCConnectionDidBecomeActive                     @"WCConnectionDidBecomeActive" 
    124132 
     133#define                                                 WCConnectionGotServerError                      @"WCConnectionGotServerError" 
    125134#define                                                 WCConnectionGotServerInfo                       @"WCConnectionGotServerInfo" 
    126135#define                                                 WCConnectionGotPrivileges                       @"WCConnectionGotPrivileges" 
     
    134143- (id)                                                  initTrackerConnectionWithURL:(NSURL *)url tracker:(WCTracker *)tracker; 
    135144 
    136 - (void)                                                sendCommand:(NSString *)command
    137 - (void)                                                sendCommand:(NSString *)command withArgument:(NSString *)argument1
    138 - (void)                                                sendCommand:(NSString *)command withArgument:(NSString *)argument1 withArgument:(NSString *)argument2
    139 - (void)                                                sendCommand:(NSString *)command withArgument:(NSString *)argument1 withArgument:(NSString *)argument2 withArgument:(NSString *)argument3
     145- (void)                                                sendCommand:(NSString *)command withSender:(id)sender
     146- (void)                                                sendCommand:(NSString *)command withArgument:(NSString *)argument1 withSender:(id)sender
     147- (void)                                                sendCommand:(NSString *)command withArgument:(NSString *)argument1 withArgument:(NSString *)argument2 withSender:(id)sender;
     148- (void)                                                sendCommand:(NSString *)command withArgument:(NSString *)argument1 withArgument:(NSString *)argument2 withArgument:(NSString *)argument3 withSender:(id)sender
    140149- (void)                                                receiveData:(NSData *)data; 
    141150         
  • WiredClient/trunk/WCConnection.m

    r1315 r1317  
    1 /* $Id: WCConnection.m,v 1.13 2004/05/23 03:14:22 morris Exp $ */ 
     1/* $Id: WCConnection.m,v 1.14 2004/05/23 07:24:21 morris Exp $ */ 
    22 
    33/* 
     
    121121        [[NSNotificationCenter defaultCenter] 
    122122                        addObserver:self 
     123                           selector:@selector(connectionGotServerError:) 
     124                                   name:WCConnectionGotServerError 
     125                                 object:NULL]; 
     126         
     127        [[NSNotificationCenter defaultCenter] 
     128                        addObserver:self 
    123129                           selector:@selector(connectionGotServerInfo:) 
    124130                                   name:WCConnectionGotServerInfo 
     
    236242 
    237243 
     244- (void)connectionShouldHandleError:(int)error { 
     245        switch(error) { 
     246                case 510: 
     247                case 511: 
     248                        [[NSNotificationCenter defaultCenter] 
     249                                postNotificationName:WCConnectionShouldTerminate 
     250                                object:self]; 
     251                        break; 
     252        } 
     253} 
     254         
     255 
     256 
     257- (void)connectionGotServerError:(NSNotification *)notification { 
     258        WCConnection    *connection; 
     259        int                             error; 
     260         
     261        connection  = [[notification object] objectAtIndex:0]; 
     262        error           = [[[notification object] objectAtIndex:1] intValue]; 
     263         
     264        if(connection != self) 
     265                return; 
     266         
     267        switch(error) { 
     268                case 500: 
     269                        [[self error] setError:WCServerErrorCommandFailed]; 
     270                        [[self error] raiseError]; 
     271                        break; 
     272                 
     273                case 501: 
     274                        [[self error] setError:WCServerErrorCommandNotRecognized]; 
     275                        [[self error] raiseError]; 
     276                        break; 
     277                         
     278                case 502: 
     279                        [[self error] setError:WCServerErrorCommandNotImplemented]; 
     280                        [[self error] raiseError]; 
     281                        break; 
     282                         
     283                case 503: 
     284                        [[self error] setError:WCServerErrorSyntaxError]; 
     285                        [[self error] raiseError]; 
     286                        break; 
     287                         
     288                case 510: 
     289                        [[self error] setError:WCServerErrorLoginFailed]; 
     290                        [[self error] raiseErrorInWindow:[WCSharedMain shownWindow]]; 
     291                        break; 
     292                         
     293                case 511: 
     294                        [[self error] setError:WCServerErrorBanned]; 
     295                        [[self error] raiseErrorInWindow:[WCSharedMain shownWindow]]; 
     296                        break; 
     297                         
     298                case 512: 
     299                        [[self error] setError:WCServerErrorClientNotFound]; 
     300                        [[self error] raiseError]; 
     301                        break; 
     302                         
     303                case 513: 
     304                        [[self error] setError:WCServerErrorAccountNotFound]; 
     305                        [[self error] raiseError]; 
     306                        break; 
     307                         
     308                case 514: 
     309                        [[self error] setError:WCServerErrorAccountExists]; 
     310                        [[self error] raiseError]; 
     311                        break; 
     312                         
     313                case 515: 
     314                        [[self error] setError:WCServerErrorCannotBeDisconnected]; 
     315                        [[self error] raiseError]; 
     316                        break; 
     317                         
     318                case 516: 
     319                        [[self error] setError:WCServerErrorPermissionDenied]; 
     320                        [[self error] raiseError]; 
     321                        break; 
     322                         
     323                case 520: 
     324                        [[self error] setError:WCServerErrorFileNotFound]; 
     325                        [[self error] raiseError]; 
     326                        break; 
     327                         
     328                case 521: 
     329                        [[self error] setError:WCServerErrorFileExists]; 
     330                        [[self error] raiseError]; 
     331                        break; 
     332        } 
     333         
     334        if([_sender respondsToSelector:@selector(connectionShouldHandleError:)]) 
     335                [_sender connectionShouldHandleError:error]; 
     336} 
     337 
     338 
     339 
    238340- (void)connectionGotServerInfo:(NSNotification *)notification { 
    239341        NSArray                 *fields; 
     
    268370         
    269371        // --- rest of login 
    270         [self sendCommand:WCNickCommand withArgument:[WCSettings objectForKey:WCNick]]; 
     372        [self sendCommand:WCNickCommand 
     373                 withArgument:[WCSettings objectForKey:WCNick] 
     374                   withSender:self]; 
    271375         
    272376        // --- protocol 1.1 
     
    274378                [self sendCommand:WCIconCommand 
    275379                         withArgument:[WCSettings objectForKey:WCIcon] 
    276                          withArgument:[WCSettings objectForKey:WCCustomIcon]]; 
    277                 [self sendCommand:WCStatusCommand withArgument:[WCSettings objectForKey:WCStatus]]; 
     380                         withArgument:[WCSettings objectForKey:WCCustomIcon] 
     381                           withSender:self]; 
     382                [self sendCommand:WCStatusCommand 
     383                         withArgument:[WCSettings objectForKey:WCStatus] 
     384                           withSender:self]; 
    278385        } else { 
    279                 [self sendCommand:WCIconCommand withArgument:[WCSettings objectForKey:WCIcon]]; 
    280         } 
    281          
    282         [self sendCommand:WCClientCommand withArgument:[WCSharedMain clientVersion]]; 
    283         [self sendCommand:WCUserCommand withArgument:[[url user] length] > 0 
    284                 ? [[url user] stringByReplacingURLPercentEscapes] 
    285                 : @"guest"]; 
    286         [self sendCommand:WCPassCommand withArgument:[[url password] length] > 0 
    287                 ? [[[url password] stringByReplacingURLPercentEscapes] SHA1] 
    288                 : @""]; 
    289         [self sendCommand:WCPrivilegesCommand]; 
    290         [self sendCommand:WCWhoCommand withArgument:[NSString stringWithFormat:@"%u", 1]]; 
     386                [self sendCommand:WCIconCommand 
     387                         withArgument:[WCSettings objectForKey:WCIcon] 
     388                           withSender:self]; 
     389        } 
     390         
     391        [self sendCommand:WCClientCommand 
     392                 withArgument:[WCSharedMain clientVersion] 
     393                   withSender:self]; 
     394        [self sendCommand:WCUserCommand 
     395                 withArgument:[[url user] length] > 0 
     396                        ? [[url user] stringByReplacingURLPercentEscapes] 
     397                        : @"guest" 
     398                   withSender:self]; 
     399        [self sendCommand:WCPassCommand 
     400                 withArgument:[[url password] length] > 0 
     401                        ? [[[url password] stringByReplacingURLPercentEscapes] SHA1] 
     402                        : @"" 
     403                   withSender:self]; 
     404        [self sendCommand:WCPrivilegesCommand withSender:self]; 
     405        [self sendCommand:WCWhoCommand  
     406                 withArgument:[NSString stringWithFormat:@"%u", 1] 
     407                   withSender:self]; 
    291408         
    292409        if([WCSettings boolForKey:WCLoadNewsOnLogin]) 
    293                 [self sendCommand:WCNewsCommand]; 
     410                [self sendCommand:WCNewsCommand withSender:self]; 
    294411         
    295412        // --- protocol 1.1 
    296413        if([_server protocol] >= 1.1) 
    297                 [self sendCommand:WCBannerCommand]; 
     414                [self sendCommand:WCBannerCommand withSender:self]; 
    298415} 
    299416 
     
    364481         
    365482        // --- initial login 
    366         [self sendCommand:WCHelloCommand]; 
     483        [self sendCommand:WCHelloCommand withSender:self]; 
    367484         
    368485        // --- start reading from server 
     
    419536         
    420537        // --- initial login 
    421         [self sendCommand:WCHelloCommand]; 
    422         [self sendCommand:WCClientCommand withArgument:[WCSharedMain clientVersion]]; 
    423         [self sendCommand:WCCategoriesCommand]; 
    424         [self sendCommand:WCServersCommand]; 
     538        [self sendCommand:WCHelloCommand withSender:self]; 
     539        [self sendCommand:WCClientCommand 
     540                 withArgument:[WCSharedMain clientVersion] 
     541                   withSender:self]; 
     542        [self sendCommand:WCCategoriesCommand withSender:self]; 
     543        [self sendCommand:WCServersCommand withSender:self]; 
    425544         
    426545        // --- start reading from server 
     
    445564 
    446565- (void)pingTimer:(NSTimer *)timer { 
    447         [self sendCommand:WCPingCommand]; 
     566        [self sendCommand:WCPingCommand withSender:self]; 
    448567} 
    449568 
     
    452571#pragma mark - 
    453572 
    454 - (void)sendCommand:(NSString *)command { 
    455         [self sendCommand:command withArgument:NULL withArgument:NULL withArgument:NULL]; 
    456 
    457  
    458  
    459  
    460 - (void)sendCommand:(NSString *)command withArgument:(NSString *)argument1 { 
    461         [self sendCommand:command withArgument:argument1 withArgument:NULL withArgument:NULL]; 
    462 
    463  
    464  
    465  
    466 - (void)sendCommand:(NSString *)command withArgument:(NSString *)argument1 withArgument:(NSString *)argument2 { 
    467         [self sendCommand:command withArgument:argument1 withArgument:argument2 withArgument:NULL]; 
    468 
    469  
    470  
    471  
    472 - (void)sendCommand:(NSString *)command withArgument:(NSString *)argument1 withArgument:(NSString *)argument2 withArgument:(NSString *)argument3 { 
     573- (void)sendCommand:(NSString *)command withSender:(id)sender { 
     574        [self sendCommand:command 
     575                 withArgument:NULL 
     576                 withArgument:NULL 
     577                 withArgument:NULL 
     578                   withSender:sender]; 
     579
     580 
     581 
     582 
     583- (void)sendCommand:(NSString *)command withArgument:(NSString *)argument1 withSender:(id)sender { 
     584        [self sendCommand:command 
     585                 withArgument:argument1 
     586                 withArgument:NULL 
     587                 withArgument:NULL 
     588                   withSender:sender]; 
     589
     590 
     591 
     592 
     593- (void)sendCommand:(NSString *)command withArgument:(NSString *)argument1 withArgument:(NSString *)argument2 withSender:(id)sender { 
     594        [self sendCommand:command 
     595                 withArgument:argument1 
     596                 withArgument:argument2 
     597                 withArgument:NULL 
     598                   withSender:sender]; 
     599
     600 
     601 
     602 
     603- (void)sendCommand:(NSString *)command withArgument:(NSString *)argument1 withArgument:(NSString *)argument2 withArgument:(NSString *)argument3 withSender:(id)sender { 
    473604        NSString        *string = command; 
    474605        NSData          *data; 
     
    487618                        command, argument1]; 
    488619        } 
     620         
     621        // --- save sender 
     622        _sender = sender; 
    489623         
    490624        // --- write to console 
     
    704838                 
    705839                case 500: 
    706                         [[self error] setError:WCServerErrorCommandFailed]; 
    707                         [[self error] raiseError]; 
    708                         break; 
    709                  
    710840                case 501: 
    711                         [[self error] setError:WCServerErrorCommandNotRecognized]; 
    712                         [[self error] raiseError]; 
    713                         break; 
    714                  
    715841                case 502: 
    716                         [[self error] setError:WCServerErrorCommandNotImplemented]; 
    717                         [[self error] raiseError]; 
    718                         break; 
    719                          
    720842                case 503: 
    721                         [[self error] setError:WCServerErrorSyntaxError]; 
    722                         [[self error] raiseError]; 
    723                         break; 
    724                  
    725843                case 510: 
    726                         [[self error] setError:WCServerErrorLoginFailed]; 
    727                         [[self error] raiseErrorInWindow:[WCSharedMain shownWindow]]; 
    728          
    729                         [[NSNotificationCenter defaultCenter] 
    730                                 mainThreadPostNotificationName:WCConnectionShouldTerminate 
    731                                 object:self]; 
    732  
    733                         [_socket close]; 
    734                         break; 
    735                          
    736844                case 511: 
    737                         [[self error] setError:WCServerErrorBanned]; 
    738                         [[self error] raiseErrorInWindow:[WCSharedMain shownWindow]]; 
    739  
    740                         [[NSNotificationCenter defaultCenter] 
    741                                 mainThreadPostNotificationName:WCConnectionShouldTerminate 
    742                                 object:self]; 
    743                          
    744                         [_socket close]; 
    745                         break; 
    746                  
    747845                case 512: 
    748                         [[self error] setError:WCServerErrorClientNotFound]; 
    749                         [[self error] raiseError]; 
    750                         break; 
    751                  
    752846                case 513: 
    753                         [[self error] setError:WCServerErrorAccountNotFound]; 
    754                         [[self error] raiseError]; 
    755                         break; 
    756                  
    757847                case 514: 
    758                         [[self error] setError:WCServerErrorAccountExists]; 
    759                         [[self error] raiseError]; 
    760                         break; 
    761                  
    762848                case 515: 
    763                         [[self error] setError:WCServerErrorCannotBeDisconnected]; 
    764                         [[self error] raiseError]; 
    765                         break; 
    766                  
    767849                case 516: 
    768                         [[self error] setError:WCServerErrorPermissionDenied]; 
    769                         [[self error] raiseError]; 
    770                         break; 
    771                  
    772850                case 520: 
    773                         [[self error] setError:WCServerErrorFileNotFound]; 
    774                         [[self error] raiseError]; 
    775                         break; 
    776                  
    777851                case 521: 
    778                         [[self error] setError:WCServerErrorFileExists]; 
    779                         [[self error] raiseError]; 
    780                         break; 
    781                  
     852                        [[NSNotificationCenter defaultCenter] 
     853                                mainThreadPostNotificationName:WCConnectionGotServerError 
     854                                object:[NSArray arrayWithObjects:self, [NSNumber numberWithInt:message], NULL]]; 
     855                        break; 
     856 
    782857                case 600: 
    783858                        [[NSNotificationCenter defaultCenter] 
  • WiredClient/trunk/WCFileInfo.m

    r1304 r1317  
    1 /* $Id: WCFileInfo.m,v 1.12 2004/05/22 08:55:47 morris Exp $ */ 
     1/* $Id: WCFileInfo.m,v 1.13 2004/05/23 07:24:21 morris Exp $ */ 
    22 
    33/* 
     
    6767 
    6868        // --- send the stat command 
    69         [_connection sendCommand:WCStatCommand withArgument:[_file path]]; 
     69        [_connection sendCommand:WCStatCommand withArgument:[_file path] withSender:self]; 
    7070 
    7171        return self; 
     
    111111                [_connection sendCommand:WCMoveCommand 
    112112                                        withArgument:[_file path] 
    113                                         withArgument:[path stringByAppendingPathComponent:[_fileTextField stringValue]]]; 
     113                                        withArgument:[path stringByAppendingPathComponent:[_fileTextField stringValue]] 
     114                                          withSender:self]; 
    114115         
    115116                reload = YES; 
     
    124125                [_connection sendCommand:WCCommentCommand 
    125126                                        withArgument:[path stringByAppendingPathComponent:[_fileTextField stringValue]] 
    126                                         withArgument:[_commentTextField stringValue]]; 
     127                                        withArgument:[_commentTextField stringValue] 
     128                                          withSender:self]; 
    127129        } 
    128130         
     
    137139                                        withArgument:[path stringByAppendingPathComponent:[_fileTextField stringValue]] 
    138140                                        withArgument:[NSString stringWithFormat:@"%u", 
    139                                                 [_kindPopUpButton tagOfSelectedItem]]]; 
     141                                                [_kindPopUpButton tagOfSelectedItem]] 
     142                                          withSender:self]; 
    140143                 
    141144                reload = YES; 
     
    162165        if([notification object] == _connection) 
    163166                [self close]; 
     167} 
     168 
     169 
     170 
     171 
     172- (void)connectionShouldHandleError:(int)error { 
     173        [self release]; 
    164174} 
    165175 
  • WiredClient/trunk/WCFiles.m

    r1316 r1317  
    1 /* $Id: WCFiles.m,v 1.35 2004/05/23 03:29:02 morris Exp $ */ 
     1/* $Id: WCFiles.m,v 1.36 2004/05/23 07:24:21 morris Exp $ */ 
    22 
    33/* 
     
    347347 
    348348                // --- send the delete command 
    349                 [_connection sendCommand:WCDeleteCommand withArgument:[file path]]; 
     349                [_connection sendCommand:WCDeleteCommand withArgument:[file path] withSender:self]; 
    350350 
    351351                // --- reload all files affected 
     
    366366 
    367367                // --- send the new folder command 
    368                 [_connection sendCommand:WCFolderCommand withArgument:path]; 
     368                [_connection sendCommand:WCFolderCommand withArgument:path withSender:self]; 
    369369                 
    370370                // --- reload all files affected 
     
    547547                 
    548548                // --- send the list command 
    549                 [_connection sendCommand:WCListCommand withArgument:[_path path]]; 
     549                [_connection sendCommand:WCListCommand withArgument:[_path path] withSender:self]; 
    550550        } 
    551551} 
     
    11761176                        [_connection sendCommand:WCMoveCommand 
    11771177                                                withArgument:[source path] 
    1178                                                 withArgument:[[destination path] stringByAppendingPathComponent:[source name]]]; 
     1178                                                withArgument:[[destination path] stringByAppendingPathComponent:[source name]] 
     1179                                                  withSender:self]; 
    11791180                         
    11801181                        // --- announce reloads on both this, the source and their parents 
  • WiredClient/trunk/WCMain.m

    r1298 r1317  
    1 /* $Id: WCMain.m,v 1.27 2004/05/22 02:18:09 morris Exp $ */ 
     1/* $Id: WCMain.m,v 1.28 2004/05/23 07:24:21 morris Exp $ */ 
    22 
    33/* 
     
    522522                [connection sendCommand:WCSayCommand 
    523523    &nbs