Changeset 3503

Show
Ignore:
Timestamp:
01/16/06 22:14:04 (3 years ago)
Author:
morris
Message:

Clean up trackers window a bit:

- Fix tracker connections (not final)
- Make search field a proper Cocoa search field now that we are 10.3
- Replace "Rendezvous" with "Bonjour"

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/English.lproj/Trackers.nib/classes.nib

    r3406 r3503  
    1919                "_nameTableColumn" = NSTableColumn;  
    2020                "_progressIndicator" = NSProgressIndicator;  
    21                 "_searchTextField" = NSTextField;  
     21                "_searchField" = NSSearchField;  
    2222                "_sizeTableColumn" = NSTableColumn;  
    2323                "_speedTableColumn" = NSTableColumn;  
     
    3434            SUPERCLASS = NSOutlineView;  
    3535        },  
     36        {CLASS = WISearchField; LANGUAGE = ObjC; SUPERCLASS = NSSearchField; },  
    3637        { 
    3738            CLASS = WIWindowController;  
  • WiredClient/trunk/English.lproj/Trackers.nib/info.nib

    r3406 r3503  
    1212        </array> 
    1313        <key>IBSystem Version</key> 
    14         <string>8F46</string> 
     14        <string>8G32</string> 
    1515</dict> 
    1616</plist> 
  • WiredClient/trunk/WCChat.m

    r3414 r3503  
    672672        [_userListTableView reloadData]; 
    673673 
    674       [[self connection] postNotificationName:WCConnectionTriggeredEvent 
    675                                                                        object:[NSNumber numberWithInt:WCEventsUserJoined]]; 
     674//    [[self connection] postNotificationName:WCConnectionTriggeredEvent 
     675//                                                                     object:[NSNumber numberWithInt:WCEventsUserJoined]]; 
    676676} 
    677677 
     
    701701        [_userListTableView reloadData]; 
    702702 
    703       [[self connection] postNotificationName:WCConnectionTriggeredEvent 
    704                                                                        object:[NSNumber numberWithInt:WCEventsUserLeft]]; 
     703//    [[self connection] postNotificationName:WCConnectionTriggeredEvent 
     704//                                                                     object:[NSNumber numberWithInt:WCEventsUserLeft]]; 
    705705} 
    706706 
     
    842842        [self _printChat:chat by:user]; 
    843843 
    844       [[self connection] postNotificationName:WCConnectionTriggeredEvent 
    845                                                                        object:[NSNumber numberWithInt:WCEventsChatReceived]]; 
     844//    [[self connection] postNotificationName:WCConnectionTriggeredEvent 
     845//                                                                     object:[NSNumber numberWithInt:WCEventsChatReceived]]; 
    846846} 
    847847 
     
    871871        [self _printActionChat:chat by:user]; 
    872872 
    873       [[self connection] postNotificationName:WCConnectionTriggeredEvent 
    874                                                                        object:[NSNumber numberWithInt:WCEventsChatReceived]]; 
     873//    [[self connection] postNotificationName:WCConnectionTriggeredEvent 
     874//                                                                     object:[NSNumber numberWithInt:WCEventsChatReceived]]; 
    875875} 
    876876 
  • WiredClient/trunk/WCConnection.h

    r3413 r3503  
    125125#define WCWhoCommand                                    @"WHO" 
    126126 
    127 #define WCConnectionConnected                   @"WCConnectionConnected" 
    128 #define WCConnectionClosed                              @"WCConnectionClosed" 
     127#define WCConnectionDidConnect                  @"WCConnectionDidConnect" 
     128#define WCConnectionDidFail                             @"WCConnectionDidFail" 
     129#define WCConnectionDidClose                    @"WCConnectionDidClose" 
    129130#define WCConnectionWillTerminate               @"WCConnectionWillTerminate" 
    130131#define WCConnectionShouldTerminate             @"WCConnectionShouldTerminate" 
    131132#define WCConnectionDidTerminate                @"WCConnectionDidTerminate" 
     133 
    132134#define WCConnectionReceivedMessage             @"WCConnectionReceivedMessage" 
    133135#define WCConnectionSentCommand                 @"WCConnectionSentCommand" 
    134 #define WCConnectionReceivedError               @"WCConnectionReceivedError" 
    135  
    136 #define WCConnectionDisconnected                @"WCConnectionDisconnected" 
    137136 
    138137#define WCArgumentsKey                                  @"WCArgumentsKey" 
    139138#define WCIdentifierKey                                 @"WCIdentifierKey" 
    140139#define WCSenderKey                                             @"WCSenderKey" 
    141  
    142  
    143  
    144  
    145 #define WCConnectionHasAttached                         @"WCConnectionHasAttached" 
    146 #define WCConnectionHasReattached                       @"WCConnectionHasReattached" 
    147 #define WCConnectionHasClosed                           @"WCConnectionHasClosed" 
    148 #define WCConnectionShouldTerminate                     @"WCConnectionShouldTerminate" 
    149 #define WCConnectionShouldCancel                        @"WCConnectionShouldCancel" 
    150 #define WCConnectionShouldHide                          @"WCConnectionShouldHide" 
    151 #define WCConnectionShouldUnhide                        @"WCConnectionShouldUnhide" 
    152  
    153 #define WCConnectionReceivedMessage                     @"WCConnectionReceivedMessage" 
    154 #define WCConnectionSentMessage                         @"WCConnectionSentMessage" 
    155 #define WCConnectionReceivedPing                        @"WCConnectionReceivedPing" 
    156 #define WCConnectionReceivedServerError         @"WCConnectionReceivedServerError" 
    157 #define WCConnectionReceivedServerInfo          @"WCConnectionReceivedServerInfo" 
    158 #define WCConnectionReceivedServerBanner        @"WCConnectionReceivedServerBanner" 
    159 #define WCConnectionReceivedPrivileges          @"WCConnectionReceivedPrivileges" 
    160 #define WCConnectionReceivedTrackerInfo         @"WCConnectionReceivedTrackerInfo" 
    161  
    162 #define WCConnectionTriggeredEvent                      @"WCConnectionTriggeredEvent" 
  • WiredClient/trunk/WCConnectionController.m

    r3413 r3503  
    5252        _connection = [connection retain]; 
    5353 
    54         if([self respondsToSelector:@selector(connectionConnected:)]) { 
    55                 [_connection addObserver:self 
    56                                                 selector:@selector(connectionConnected:) 
    57                                                         name:WCConnectionConnected]; 
    58         } 
    59  
    60         if([self respondsToSelector:@selector(connectionClosed:)]) { 
    61                 [_connection addObserver:self 
    62                                                 selector:@selector(connectionClosed:) 
    63                                                         name:WCConnectionClosed]; 
     54        if([self respondsToSelector:@selector(connectionDidConnect:)]) { 
     55                [_connection addObserver:self 
     56                                                selector:@selector(connectionDidConnect:) 
     57                                                        name:WCConnectionDidConnect]; 
     58        } 
     59 
     60        if([self respondsToSelector:@selector(connectionDidClose:)]) { 
     61                [_connection addObserver:self 
     62                                                selector:@selector(connectionDidClose:) 
     63                                                        name:WCConnectionDidClose]; 
    6464        } 
    6565         
  • WiredClient/trunk/WCDock.m

    r3413 r3503  
    7373         
    7474        // --- subscribe to these 
    75       [[WCMain main] addObserver:self 
     75/*    [[WCMain main] addObserver:self 
    7676                                          selector:@selector(connectionHasAttached:) 
    7777                                                  name:WCConnectionHasAttached]; 
     
    8484                                          selector:@selector(connectionShouldTerminate:) 
    8585                                                  name:WCConnectionShouldTerminate]; 
    86  
     86*/ 
    8787        [[WCMain main] addObserver:self 
    8888                                          selector:@selector(chatUsersDidChange:) 
     
    143143 
    144144- (void)connectionHasAttached:(NSNotification *)notification { 
    145       NSEnumerator            *enumerator; 
     145/*    NSEnumerator            *enumerator; 
    146146        WCServerConnection      *connection, *each; 
    147147         
     
    162162 
    163163        [_dockTableView reloadData]; 
    164         [self updateStatus]; 
     164        [self updateStatus];*/ 
    165165} 
    166166 
     
    268268 
    269269- (void)openConnection:(WCServerConnection *)connection { 
    270       NSEnumerator            *enumerator; 
     270/*    NSEnumerator            *enumerator; 
    271271        WCServerConnection      *each; 
    272272 
     
    291291                [[connection chat] showWindow:self]; 
    292292                [self validate]; 
    293         } 
     293        }*/ 
    294294} 
    295295 
     
    305305 
    306306- (IBAction)hide:(id)sender { 
    307       WCServerConnection      *connection; 
     307/*    WCServerConnection      *connection; 
    308308         
    309309        connection = [self selectedConnection]; 
     
    315315 
    316316        [self validate]; 
    317         [_dockTableView setNeedsDisplay:YES]; 
     317        [_dockTableView setNeedsDisplay:YES];*/ 
    318318} 
    319319 
     
    321321 
    322322- (IBAction)hideConnection:(id)sender { 
    323       WCServerConnection      *connection; 
     323/*    WCServerConnection      *connection; 
    324324         
    325325        connection = [(WCConnectionController *) [[NSApp keyWindow] windowController] connection]; 
     
    327327         
    328328        [self validate]; 
    329         [_dockTableView setNeedsDisplay:YES]; 
     329        [_dockTableView setNeedsDisplay:YES];*/ 
    330330} 
    331331 
  • WiredClient/trunk/WCError.m

    r3413 r3503  
    5252         
    5353        // --- subscribe to these 
    54       [[WCMain main] addObserver:self 
     54/*    [[WCMain main] addObserver:self 
    5555                                          selector:@selector(connectionHasAttached:) 
    5656                                                  name:WCConnectionHasAttached]; 
     
    5858        [[WCMain main] addObserver:self 
    5959                                          selector:@selector(connectionShouldTerminate:) 
    60                                                   name:WCConnectionShouldTerminate]; 
     60                                                  name:WCConnectionShouldTerminate];*/ 
    6161         
    6262        return self; 
     
    581581                [_lock unlock]; 
    582582                 
    583               [connection postNotificationName:WCConnectionTriggeredEvent 
    584                                                                 object:[NSNumber numberWithInt:WCEventsError]]; 
     583//            [connection postNotificationName:WCConnectionTriggeredEvent 
     584//                                                              object:[NSNumber numberWithInt:WCEventsError]]; 
    585585        } 
    586586         
  • WiredClient/trunk/WCLink.m

    r3413 r3503  
    209209                if(_delegateLinkFailed) 
    210210                        [_delegate linkFailed:self]; 
     211                 
    211212                goto end; 
    212213        } 
  • WiredClient/trunk/WCMain.m

    r3420 r3503  
    493493 
    494494- (IBAction)connect:(id)sender { 
    495         WIURL                           *url; 
    496         WCServerConnection      *connection; 
     495        WIURL           *url; 
    497496         
    498497        [[self window] close]; 
     
    502501        [url setPassword:[_passwordTextField stringValue]]; 
    503502         
    504         connection = [[WCServerConnection alloc] initServerConnectionWithURL:url]; 
    505         [connection connect]; 
     503        [[WCServerConnection serverConnectionWithURL:url] connect]; 
    506504} 
    507505 
     
    575573        NSString                        *address, *login, *password; 
    576574        WIURL                           *url; 
    577         WCServerConnection      *connection; 
    578575 
    579576        // --- get bookmark 
     
    588585        [url setPassword:password ? password : @""]; 
    589586         
    590         connection = [[WCServerConnection alloc] initServerConnectionWithURL:url bookmark:bookmark]; 
    591         [connection connect]; 
     587        [[WCServerConnection serverConnectionWithURL:url bookmark:bookmark] connect]; 
    592588} 
    593589 
  • WiredClient/trunk/WCMessages.m

    r3443 r3503  
    374374        [[self connection] postNotificationName:WCMessagesDidAddMessage object:[self connection]]; 
    375375         
    376       [[self connection] postNotificationName:WCConnectionTriggeredEvent 
    377                                                                        object:[NSNumber numberWithInt:WCEventsMessageReceived]]; 
     376//    [[self connection] postNotificationName:WCConnectionTriggeredEvent 
     377//                                                                     object:[NSNumber numberWithInt:WCEventsMessageReceived]]; 
    378378} 
    379379 
     
    416416        [[self connection] postNotificationName:WCMessagesDidAddMessage object:[self connection]]; 
    417417         
    418       [[self connection] postNotificationName:WCConnectionTriggeredEvent 
    419                                                                        object:[NSNumber numberWithInt:WCEventsBroadcastReceived]]; 
     418//    [[self connection] postNotificationName:WCConnectionTriggeredEvent 
     419//                                                                     object:[NSNumber numberWithInt:WCEventsBroadcastReceived]]; 
    420420} 
    421421 
  • WiredClient/trunk/WCPublicChat.m

    r3414 r3503  
    288288 
    289289 
    290 - (void)connectionClosed:(NSNotification *)notification { 
     290- (void)connectionDidClose:(NSNotification *)notification { 
    291291        [WCError setWithError:WCApplicationErrorServerDisconnected]; 
    292292        [WCError show]; 
  • WiredClient/trunk/WCServerConnection.h

    r3413 r3503  
    2828 
    2929#import "WCConnection.h" 
    30  
    31 @protocol WCConnection; 
    3230 
    3331@class WCServer, WCCache, WCAccount; 
     
    120118 
    121119 
    122 - (id)initServerConnectionWithURL:(WIURL *)url; 
    123 - (id)initServerConnectionWithURL:(WIURL *)url bookmark:(NSDictionary *)bookmark; 
     120+ (id)serverConnectionWithURL:(WIURL *)url; 
     121+ (id)serverConnectionWithURL:(WIURL *)url bookmark:(NSDictionary *)bookmark; 
    124122 
    125123- (BOOL)isHidden; 
  • WiredClient/trunk/WCServerConnection.m

    r3420 r3503  
    4444@interface WCServerConnection(Private) 
    4545 
     46- (id)_initServerConnectionWithURL:(WIURL *)url bookmark:(NSDictionary *)bookmark; 
     47 
    4648- (void)_login; 
    4749 
     
    5052 
    5153@implementation WCServerConnection(Private) 
     54 
     55- (id)_initServerConnectionWithURL:(WIURL *)url bookmark:(NSDictionary *)bookmark { 
     56        self = [super initWithWindowNibName:@"Connection"]; 
     57         
     58        _bookmark = [bookmark retain]; 
     59         
     60        _server = [[WCServer alloc] init]; 
     61        [_server setName:[bookmark objectForKey:WCBookmarksName]]; 
     62        [_server setURL:url]; 
     63 
     64        _cache = [[WCCache alloc] initWithCapacity:100]; 
     65 
     66        _link = [[WCLink alloc] initLinkWithURL:url]; 
     67        [_link setDelegate:self]; 
     68 
     69        _notificationCenter = [[NSNotificationCenter alloc] init]; 
     70         
     71        [self addObserver:self 
     72                         selector:@selector(connectionShouldTerminate:) 
     73                                 name:WCConnectionShouldTerminate]; 
     74 
     75        [self addObserver:self 
     76                         selector:@selector(connectionDidTerminate:) 
     77                                 name:WCConnectionDidTerminate]; 
     78 
     79        [self addObserver:self 
     80                         selector:@selector(serverConnectionReceivedServerInfo:) 
     81                                 name:WCServerConnectionReceivedServerInfo]; 
     82 
     83        [self addObserver:self 
     84                         selector:@selector(serverConnectionReceivedSelf:) 
     85                                 name:WCServerConnectionReceivedSelf]; 
     86         
     87        [self addObserver:self 
     88                         selector:@selector(serverConnectionReceivedPing:) 
     89                                 name:WCServerConnectionReceivedPing]; 
     90 
     91        [self addObserver:self 
     92                         selector:@selector(serverConnectionReceivedBanner:) 
     93                                 name:WCServerConnectionReceivedBanner]; 
     94 
     95        [self addObserver:self 
     96                         selector:@selector(serverConnectionReceivedPrivileges:) 
     97                                 name:WCServerConnectionReceivedPrivileges]; 
     98 
     99#if defined(DEBUG) || defined(TEST) 
     100        _console        = [[WCConsole alloc] initConsoleWithConnection:self]; 
     101#endif 
     102         
     103        _accounts       = [[WCAccounts alloc] initAccountsWithConnection:self]; 
     104        _news           = [[WCNews alloc] initNewsWithConnection:self]; 
     105        _messages       = [[WCMessages alloc] initMessagesWithConnection:self]; 
     106        _search         = [[WCSearch alloc] initSearchWithConnection:self]; 
     107        _serverInfo     = [[WCServerInfo alloc] initServerInfoWithConnection:self]; 
     108        _transfers      = [[WCTransfers alloc] initTransfersWithConnection:self]; 
     109         
     110        _chat           = [[WCPublicChat alloc] initPublicChatWithConnection:self]; 
     111 
     112        return self; 
     113} 
     114 
     115 
    52116 
    53117- (void)_login { 
     
    91155@implementation WCServerConnection 
    92156 
    93 - (id)initServerConnectionWithURL:(WIURL *)url { 
    94         return [self initServerConnectionWithURL:url bookmark:NULL]; 
    95 
    96  
    97  
    98  
    99 - (id)initServerConnectionWithURL:(WIURL *)url bookmark:(NSDictionary *)bookmark { 
    100         self = [super initWithWindowNibName:@"Connection"]; 
    101          
    102         _bookmark = [bookmark retain]; 
    103          
    104         _server = [[WCServer alloc] init]; 
    105         [_server setName:[bookmark objectForKey:WCBookmarksName]]; 
    106         [_server setURL:url]; 
    107  
    108         _cache = [[WCCache alloc] initWithCapacity:100]; 
    109  
    110         _link = [[WCLink alloc] initLinkWithURL:url]; 
    111         [_link setDelegate:self]; 
    112  
    113         _notificationCenter = [[NSNotificationCenter alloc] init]; 
    114          
    115         [self addObserver:self 
    116                          selector:@selector(connectionShouldTerminate:) 
    117                                  name:WCConnectionShouldTerminate]; 
    118  
    119         [self addObserver:self 
    120                          selector:@selector(connectionDidTerminate:) 
    121                                  name:WCConnectionDidTerminate]; 
    122  
    123         [self addObserver:self 
    124                          selector:@selector(serverConnectionReceivedServerInfo:) 
    125                                  name:WCServerConnectionReceivedServerInfo]; 
    126  
    127         [self addObserver:self 
    128                          selector:@selector(serverConnectionReceivedSelf:) 
    129                                  name:WCServerConnectionReceivedSelf]; 
    130          
    131         [self addObserver:self 
    132                          selector:@selector(serverConnectionReceivedPing:) 
    133                                  name:WCServerConnectionReceivedPing]; 
    134  
    135         [self addObserver:self 
    136                          selector:@selector(serverConnectionReceivedBanner:) 
    137                                  name:WCServerConnectionReceivedBanner]; 
    138  
    139         [self addObserver:self 
    140                          selector:@selector(serverConnectionReceivedPrivileges:) 
    141                                  name:WCServerConnectionReceivedPrivileges]; 
    142  
    143 #if defined(DEBUG) || defined(TEST) 
    144         _console        = [[WCConsole alloc] initConsoleWithConnection:self]; 
    145 #endif 
    146          
    147         _accounts       = [[WCAccounts alloc] initAccountsWithConnection:self]; 
    148         _news           = [[WCNews alloc] initNewsWithConnection:self]; 
    149         _messages       = [[WCMessages alloc] initMessagesWithConnection:self]; 
    150         _search         = [[WCSearch alloc] initSearchWithConnection:self]; 
    151         _serverInfo     = [[WCServerInfo alloc] initServerInfoWithConnection:self]; 
    152         _transfers      = [[WCTransfers alloc] initTransfersWithConnection:self]; 
    153          
    154         _chat           = [[WCPublicChat alloc] initPublicChatWithConnection:self]; 
    155  
    156         return self; 
     157+ (id)serverConnectionWithURL:(WIURL *)url { 
     158        return [[[self alloc] _initServerConnectionWithURL:url bookmark:NULL] autorelease]; 
     159
     160 
     161 
     162 
     163+ (id)serverConnectionWithURL:(WIURL *)url bookmark:(NSDictionary *)bookmark { 
     164        return [[[self alloc] _initServerConnectionWithURL:url bookmark:bookmark] autorelease]; 
    157165} 
    158166 
     
    343351 
    344352- (void)linkConnected:(WCLink *)link { 
    345         [self postNotificationName:WCConnectionConnected object:self]; 
     353        [self postNotificationName:WCConnectionDidConnect object:self]; 
    346354 
    347355        [link sendCommand:WCHelloCommand]; 
     
    351359 
    352360- (void)linkClosed:(WCLink *)link { 
    353         [self postNotificationName:WCConnectionClosed object:self]; 
     361        [self postNotificationName:WCConnectionDidClose object:self]; 
    354362} 
    355363 
     
    538546 
    539547                default: 
    540                       if(message >= 500 && message <= 599) 
    541                               name = WCConnectionReceivedError; 
     548//                    if(message >= 500 && message <= 599) 
     549//                            name = WCConnectionReceivedError; 
    542550                        break; 
    543551        } 
  • WiredClient/trunk/WCTracker.h

    r3413 r3503  
    2828 
    2929enum WCTrackerType { 
    30         WCTrackerTypeRendezvous
     30        WCTrackerTypeBonjour
    3131        WCTrackerTypeCategory, 
    3232        WCTrackerTypeServer, 
     
    4343 
    4444 
    45 @interface WCTracker : WIObject <NSCoding>
     45@interface WCTracker : WIObject
    4646        WCTrackerType                           _type; 
    4747        WCTrackerState                          _state; 
     48        NSImage                                         *_icon; 
    4849        NSString                                        *_name; 
    4950        NSString                                        *_serverDescription; 
     
    6162 
    6263 
    63 - (id)initWithType:(WCTrackerType)type; 
     64+ (id)bonjourTracker; 
     65+ (id)bonjourServerWithNetService:(NSNetService *)netService; 
     66+ (id)trackerWithBookmark:(NSDictionary *)bookmark; 
     67+ (id)trackerCategoryWithName:(NSString *)name; 
     68+ (id)trackerServerWithMessage:(NSArray *)message; 
    6469 
    65 - (void)setType:(WCTrackerType)type; 
    66 - (WCTrackerType)type; 
    6770- (void)setState:(WCTrackerState)state; 
    6871- (WCTrackerState)state; 
    69 - (void)setName:(NSString *)name; 
     72 
     73- (WCTrackerType)type; 
     74- (NSImage *)icon; 
    7075- (NSString *)name; 
    71 - (void)setServerDescription:(NSString *)serverDescription
     76- (NSString *)nameWithNumberOfServers
    7277- (NSString *)serverDescription; 
    73 - (void)setUsers:(unsigned int)users; 
    7478- (unsigned int)users; 
    75 - (void)setSpeed:(unsigned int)speed; 
    7679- (unsigned int)speed; 
    77 - (void)setFiles:(unsigned int)files; 
    7880- (unsigned int)files; 
    79 - (void)setSize:(unsigned long long)size; 
    8081- (unsigned long long)size; 
    81 - (void)setGuest:(BOOL)value; 
    8282- (BOOL)guest; 
    83 - (void)setDownload:(BOOL)value; 
    8483- (BOOL)download; 
    85 - (void)setURL:(WIURL *)url; 
    8684- (WIURL *)URL; 
    87 - (void)setNetService:(NSNetService *)netService; 
    8885- (NSNetService *)netService; 
    8986 
     
    9491- (void)sortChildrenUsingSelector:(SEL)selector; 
    9592- (NSArray *)childrenMatchingFilter:(NSString *)filter; 
     93 
     94- (WCTracker *)categoryWithName:(NSString *)name; 
     95- (WCTracker *)categoryForPath:(NSString *)path; 
    9696- (unsigned int)numberOfServers; 
    9797 
  • WiredClient/trunk/WCTracker.m

    r3413 r3503  
    3131@interface WCTracker(Private) 
    3232 
     33- (id)_initWithType:(WCTrackerType)type; 
     34 
     35- (void)_setIcon:(NSImage *)icon; 
     36- (void)_setName:(NSString *)name; 
     37- (void)_setServerDescription:(NSString *)serverDescription; 
     38- (void)_setUsers:(unsigned int)users; 
     39- (void)_setSpeed:(unsigned int)speed; 
     40- (void)_setFiles:(unsigned int)files; 
     41- (void)_setSize:(unsigned long long)size; 
     42- (void)_setGuest:(BOOL)value; 
     43- (void)_setDownload:(BOOL)value; 
     44- (void)_setURL:(WIURL *)url; 
     45- (void)_setNetService:(NSNetService *)netService; 
     46 
    3347- (NSComparisonResult)_compareName:(WCTracker *)tracker; 
    3448 
     
    3650 
    3751 
    38 @implementation WCTracker 
    39  
    40 - (id)initWithType:(WCTrackerType)type { 
     52@implementation WCTracker(Private) 
     53 
     54- (id)_initWithType:(WCTrackerType)type { 
    4155        self = [super init]; 
    4256 
    43         [self setType:type]
     57        _type = type
    4458 
    4559        if([self type] != WCTrackerTypeServer) 
     
    5165 
    5266 
    53 - (NSString *)description { 
    54         return @""; 
     67#pragma mark - 
     68 
     69- (void)_setIcon:(NSImage *)icon { 
     70        [icon retain]; 
     71        [_icon release]; 
     72 
     73        _icon = icon; 
     74
     75 
     76 
     77 
     78- (void)_setName:(NSString *)value { 
     79        [value retain]; 
     80        [_name release]; 
     81 
     82        _name = value; 
     83
     84 
     85 
     86 
     87- (void)_setServerDescription:(NSString *)value { 
     88        [value retain]; 
     89        [_serverDescription release]; 
     90 
     91        _serverDescription = value; 
     92
     93 
     94 
     95 
     96- (void)_setUsers:(unsigned int)users { 
     97        _users = users; 
     98
     99 
     100 
     101 
     102- (void)_setSpeed:(unsigned int)speed { 
     103        _speed = speed; 
     104
     105 
     106 
     107 
     108- (void)_setFiles:(unsigned int)files { 
     109        _files = files; 
     110
     111 
     112 
     113 
     114- (void)_setSize:(unsigned long long)size { 
     115        _size = size; 
     116
     117 
     118 
     119 
     120- (void)_setGuest:(BOOL)guest { 
     121        _guest = guest; 
     122
     123 
     124 
     125 
     126- (void)_setDownload:(BOOL)download { 
     127        _download = download; 
     128
     129 
     130 
     131 
     132- (void)_setURL:(WIURL *)value { 
     133        [value retain]; 
     134        [_url release]; 
     135 
     136        _url = value; 
     137
     138 
     139 
     140 
     141- (void)_setNetService:(NSNetService *)value { 
     142        [value retain]; 
     143        [_netService release]; 
     144 
     145        _netService = value; 
     146
     147 
     148 
     149 
     150#pragma mark - 
     151 
     152- (NSComparisonResult)_compareName:(WCTracker *)tracker { 
     153        return [[self name] compare:[tracker name] options:NSCaseInsensitiveSearch]; 
     154
     155 
     156@end 
     157 
     158 
     159@implementation WCTracker 
     160 
     161+ (id)bonjourTracker { 
     162        WCTracker       *tracker; 
     163         
     164        tracker = [[self alloc] _initWithType:WCTrackerTypeBonjour]; 
     165        [tracker _setName:@"Bonjour"]; 
     166        [tracker _setIcon:[NSImage imageNamed:@"Bonjour"]]; 
     167 
     168        return [tracker autorelease]; 
     169
     170 
     171 
     172 
     173+ (id)bonjourServerWithNetService:(NSNetService *)netService { 
     174        WCTracker       *server; 
     175         
     176        server = [[self alloc] _initWithType:WCTrackerTypeServer]; 
     177        [server _setName:[netService name]]; 
     178        [server _setNetService:netService]; 
     179         
     180        return [server autorelease]; 
     181
     182 
     183 
     184 
     185+ (id)trackerWithBookmark:(NSDictionary *)bookmark { 
     186        WCTracker       *tracker; 
     187         
     188        tracker = [[self alloc] _initWithType:WCTrackerTypeTracker]; 
     189        [tracker _setName:[bookmark objectForKey:WCTrackerBookmarksName]]; 
     190        [tracker _setURL:[WIURL URLWithString:[bookmark objectForKey:WCTrackerBookmarksAddress] scheme:@"wiredtracker"]]; 
     191         
     192        return [tracker autorelease]; 
     193
     194 
     195 
     196 
     197+ (id)trackerCategoryWithName:(NSString *)name { 
     198        WCTracker       *category; 
     199         
     200        category = [[self alloc] _initWithType:WCTrackerTypeCategory]; 
     201        [category _setName:name]; 
     202         
     203        return [category autorelease]; 
     204
     205 
     206 
     207 
     208+ (id)trackerServerWithMessage:(NSArray *)message { 
     209        WCTracker               *server; 
     210         
     211        server = [[self alloc] _initWithType:WCTrackerTypeServer]; 
     212        [server _setURL:[WIURL URLWithString:[message safeObjectAtIndex:1] scheme:@"wiredtracker"]]; 
     213        [server _setName:[message safeObjectAtIndex:2]]; 
     214        [server _setUsers:[[message safeObjectAtIndex:3] intValue]]; 
     215        [server _setSpeed:[[message safeObjectAtIndex:4] intValue]]; 
     216        [server _setGuest:([[message safeObjectAtIndex:5] intValue] == 1)]; 
     217        [server _setDownload:([[message safeObjectAtIndex:6] intValue] == 1)]; 
     218        [server _setFiles:[[message safeObjectAtIndex:7] intValue]]; 
     219        [server _setSize:[[message safeObjectAtIndex:8] unsignedLongLongValue]]; 
     220        [server _setServerDescription:[message safeObjectAtIndex:9]]; 
     221 
     222        return [server autorelease]; 
    55223} 
    56224 
     
    72240#pragma mark - 
    73241 
    74 - (id)initWithCoder:(NSCoder *)coder { 
    75         self = [super init]; 
    76          
    77          
    78         return self; 
    79 
    80  
    81  
    82  
    83 - (void)encodeWithCoder:(NSCoder *)coder { 
    84 
     242- (void)setState:(WCTrackerState)value { 
     243        _state = value; 
     244
     245 
     246 
     247 
     248- (WCTrackerState)state { 
     249        return _state; 
     250
     251 
    85252 
    86253 
    87254 
    88255#pragma mark - 
    89  
    90 - (void)setType:(WCTrackerType)value { 
    91         _type = value; 
    92 } 
    93  
    94  
    95256 
    96257- (WCTrackerType)type { 
     
    100261 
    101262 
    102 - (void)setState:(WCTrackerState)value { 
    103         _state = value; 
    104 
    105  
    106  
    107  
    108 - (WCTrackerState)state { 
    109         return _state; 
    110 
    111  
    112  
    113  
    114 - (void)setName:(NSString *)value { 
    115         [value retain]; 
    116         [_name release]; 
    117  
    118         _name = value; 
     263- (NSImage *)icon { 
     264        return _icon; 
    119265} 
    120266 
     
    127273 
    128274 
    129 - (void)setServerDescription:(NSString *)value
    130         [value retain]; 
    131         [_serverDescription release]; 
    132  
    133         _serverDescription = value
     275- (NSString *)nameWithNumberOfServers
     276        if(_type == WCTrackerTypeCategory || _type == WCTrackerTypeTracker) 
     277               return [NSSWF:@"%@ (%u)", [self name], [self numberOfServers]]; 
     278 
     279        return [self name]
    134280} 
    135281 
     
    142288 
    143289 
    144 - (void)setUsers:(unsigned int)users { 
    145         _users = users; 
    146 } 
    147  
    148  
    149  
    150290- (unsigned int)users { 
    151291        return _users; 
     
    154294 
    155295 
    156 - (void)setSpeed:(unsigned int)speed { 
    157         _speed = speed; 
    158 } 
    159  
    160  
    161  
    162296- (unsigned int)speed { 
    163297        return _speed; 
     
    166300 
    167301 
    168 - (void)setFiles:(unsigned int)files { 
    169         _files = files; 
    170 } 
    171  
    172  
    173  
    174302- (unsigned int)files { 
    175303        return _files; 
     
    178306 
    179307 
    180 - (void)setSize:(unsigned long long)size { 
    181         _size = size; 
    182 } 
    183  
    184  
    185  
    186308- (unsigned long long)size { 
    187309        return _size; 
     
    190312 
    191313 
    192 - (void)setGuest:(BOOL)guest { 
    193         _guest = guest; 
    194 } 
    195  
    196  
    197  
    198314- (BOOL)guest { 
    199315        return _guest; 
     
    202318 
    203319 
    204 - (void)setDownload:(BOOL)download { 
    205         _download = download; 
    206 } 
    207  
    208  
    209&nbs