Changeset 3503
- Timestamp:
- 01/16/06 22:14:04 (3 years ago)
- Files:
-
- WiredClient/trunk/Bonjour.tiff (moved) (moved from WiredClient/trunk/Rendezvous.tiff)
- WiredClient/trunk/English.lproj/Trackers.nib/classes.nib (modified) (2 diffs)
- WiredClient/trunk/English.lproj/Trackers.nib/info.nib (modified) (1 diff)
- WiredClient/trunk/English.lproj/Trackers.nib/keyedobjects.nib (modified) (previous)
- WiredClient/trunk/English.lproj/Trackers.nib/objects.nib (modified) (previous)
- WiredClient/trunk/WCChat.m (modified) (4 diffs)
- WiredClient/trunk/WCConnection.h (modified) (1 diff)
- WiredClient/trunk/WCConnectionController.m (modified) (1 diff)
- WiredClient/trunk/WCDock.m (modified) (10 diffs)
- WiredClient/trunk/WCError.m (modified) (3 diffs)
- WiredClient/trunk/WCLink.m (modified) (1 diff)
- WiredClient/trunk/WCMain.m (modified) (4 diffs)
- WiredClient/trunk/WCMessages.m (modified) (2 diffs)
- WiredClient/trunk/WCPublicChat.m (modified) (1 diff)
- WiredClient/trunk/WCServerConnection.h (modified) (2 diffs)
- WiredClient/trunk/WCServerConnection.m (modified) (6 diffs)
- WiredClient/trunk/WCTracker.h (modified) (4 diffs)
- WiredClient/trunk/WCTracker.m (modified) (16 diffs)
- WiredClient/trunk/WCTrackerConnection.h (modified) (2 diffs)
- WiredClient/trunk/WCTrackerConnection.m (modified) (8 diffs)
- WiredClient/trunk/WCTrackers.h (modified) (2 diffs)
- WiredClient/trunk/WCTrackers.m (modified) (26 diffs)
- WiredClient/trunk/WCTransfers.m (modified) (3 diffs)
- WiredClient/trunk/WiredClient.xcodeproj/project.pbxproj (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/English.lproj/Trackers.nib/classes.nib
r3406 r3503 19 19 "_nameTableColumn" = NSTableColumn; 20 20 "_progressIndicator" = NSProgressIndicator; 21 "_search TextField" = NSTextField;21 "_searchField" = NSSearchField; 22 22 "_sizeTableColumn" = NSTableColumn; 23 23 "_speedTableColumn" = NSTableColumn; … … 34 34 SUPERCLASS = NSOutlineView; 35 35 }, 36 {CLASS = WISearchField; LANGUAGE = ObjC; SUPERCLASS = NSSearchField; }, 36 37 { 37 38 CLASS = WIWindowController; WiredClient/trunk/English.lproj/Trackers.nib/info.nib
r3406 r3503 12 12 </array> 13 13 <key>IBSystem Version</key> 14 <string>8 F46</string>14 <string>8G32</string> 15 15 </dict> 16 16 </plist> WiredClient/trunk/WCChat.m
r3414 r3503 672 672 [_userListTableView reloadData]; 673 673 674 [[self connection] postNotificationName:WCConnectionTriggeredEvent675 object:[NSNumber numberWithInt:WCEventsUserJoined]];674 // [[self connection] postNotificationName:WCConnectionTriggeredEvent 675 // object:[NSNumber numberWithInt:WCEventsUserJoined]]; 676 676 } 677 677 … … 701 701 [_userListTableView reloadData]; 702 702 703 [[self connection] postNotificationName:WCConnectionTriggeredEvent704 object:[NSNumber numberWithInt:WCEventsUserLeft]];703 // [[self connection] postNotificationName:WCConnectionTriggeredEvent 704 // object:[NSNumber numberWithInt:WCEventsUserLeft]]; 705 705 } 706 706 … … 842 842 [self _printChat:chat by:user]; 843 843 844 [[self connection] postNotificationName:WCConnectionTriggeredEvent845 object:[NSNumber numberWithInt:WCEventsChatReceived]];844 // [[self connection] postNotificationName:WCConnectionTriggeredEvent 845 // object:[NSNumber numberWithInt:WCEventsChatReceived]]; 846 846 } 847 847 … … 871 871 [self _printActionChat:chat by:user]; 872 872 873 [[self connection] postNotificationName:WCConnectionTriggeredEvent874 object:[NSNumber numberWithInt:WCEventsChatReceived]];873 // [[self connection] postNotificationName:WCConnectionTriggeredEvent 874 // object:[NSNumber numberWithInt:WCEventsChatReceived]]; 875 875 } 876 876 WiredClient/trunk/WCConnection.h
r3413 r3503 125 125 #define WCWhoCommand @"WHO" 126 126 127 #define WCConnectionConnected @"WCConnectionConnected" 128 #define WCConnectionClosed @"WCConnectionClosed" 127 #define WCConnectionDidConnect @"WCConnectionDidConnect" 128 #define WCConnectionDidFail @"WCConnectionDidFail" 129 #define WCConnectionDidClose @"WCConnectionDidClose" 129 130 #define WCConnectionWillTerminate @"WCConnectionWillTerminate" 130 131 #define WCConnectionShouldTerminate @"WCConnectionShouldTerminate" 131 132 #define WCConnectionDidTerminate @"WCConnectionDidTerminate" 133 132 134 #define WCConnectionReceivedMessage @"WCConnectionReceivedMessage" 133 135 #define WCConnectionSentCommand @"WCConnectionSentCommand" 134 #define WCConnectionReceivedError @"WCConnectionReceivedError"135 136 #define WCConnectionDisconnected @"WCConnectionDisconnected"137 136 138 137 #define WCArgumentsKey @"WCArgumentsKey" 139 138 #define WCIdentifierKey @"WCIdentifierKey" 140 139 #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 52 52 _connection = [connection retain]; 53 53 54 if([self respondsToSelector:@selector(connection Connected:)]) {55 [_connection addObserver:self 56 selector:@selector(connection Connected:)57 name:WCConnection Connected];58 } 59 60 if([self respondsToSelector:@selector(connection Closed:)]) {61 [_connection addObserver:self 62 selector:@selector(connection Closed:)63 name:WCConnection Closed];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]; 64 64 } 65 65 WiredClient/trunk/WCDock.m
r3413 r3503 73 73 74 74 // --- subscribe to these 75 [[WCMain main] addObserver:self75 /* [[WCMain main] addObserver:self 76 76 selector:@selector(connectionHasAttached:) 77 77 name:WCConnectionHasAttached]; … … 84 84 selector:@selector(connectionShouldTerminate:) 85 85 name:WCConnectionShouldTerminate]; 86 86 */ 87 87 [[WCMain main] addObserver:self 88 88 selector:@selector(chatUsersDidChange:) … … 143 143 144 144 - (void)connectionHasAttached:(NSNotification *)notification { 145 NSEnumerator *enumerator;145 /* NSEnumerator *enumerator; 146 146 WCServerConnection *connection, *each; 147 147 … … 162 162 163 163 [_dockTableView reloadData]; 164 [self updateStatus]; 164 [self updateStatus];*/ 165 165 } 166 166 … … 268 268 269 269 - (void)openConnection:(WCServerConnection *)connection { 270 NSEnumerator *enumerator;270 /* NSEnumerator *enumerator; 271 271 WCServerConnection *each; 272 272 … … 291 291 [[connection chat] showWindow:self]; 292 292 [self validate]; 293 } 293 }*/ 294 294 } 295 295 … … 305 305 306 306 - (IBAction)hide:(id)sender { 307 WCServerConnection *connection;307 /* WCServerConnection *connection; 308 308 309 309 connection = [self selectedConnection]; … … 315 315 316 316 [self validate]; 317 [_dockTableView setNeedsDisplay:YES]; 317 [_dockTableView setNeedsDisplay:YES];*/ 318 318 } 319 319 … … 321 321 322 322 - (IBAction)hideConnection:(id)sender { 323 WCServerConnection *connection;323 /* WCServerConnection *connection; 324 324 325 325 connection = [(WCConnectionController *) [[NSApp keyWindow] windowController] connection]; … … 327 327 328 328 [self validate]; 329 [_dockTableView setNeedsDisplay:YES]; 329 [_dockTableView setNeedsDisplay:YES];*/ 330 330 } 331 331 WiredClient/trunk/WCError.m
r3413 r3503 52 52 53 53 // --- subscribe to these 54 [[WCMain main] addObserver:self54 /* [[WCMain main] addObserver:self 55 55 selector:@selector(connectionHasAttached:) 56 56 name:WCConnectionHasAttached]; … … 58 58 [[WCMain main] addObserver:self 59 59 selector:@selector(connectionShouldTerminate:) 60 name:WCConnectionShouldTerminate]; 60 name:WCConnectionShouldTerminate];*/ 61 61 62 62 return self; … … 581 581 [_lock unlock]; 582 582 583 [connection postNotificationName:WCConnectionTriggeredEvent584 object:[NSNumber numberWithInt:WCEventsError]];583 // [connection postNotificationName:WCConnectionTriggeredEvent 584 // object:[NSNumber numberWithInt:WCEventsError]]; 585 585 } 586 586 WiredClient/trunk/WCLink.m
r3413 r3503 209 209 if(_delegateLinkFailed) 210 210 [_delegate linkFailed:self]; 211 211 212 goto end; 212 213 } WiredClient/trunk/WCMain.m
r3420 r3503 493 493 494 494 - (IBAction)connect:(id)sender { 495 WIURL *url; 496 WCServerConnection *connection; 495 WIURL *url; 497 496 498 497 [[self window] close]; … … 502 501 [url setPassword:[_passwordTextField stringValue]]; 503 502 504 connection = [[WCServerConnection alloc] initServerConnectionWithURL:url]; 505 [connection connect]; 503 [[WCServerConnection serverConnectionWithURL:url] connect]; 506 504 } 507 505 … … 575 573 NSString *address, *login, *password; 576 574 WIURL *url; 577 WCServerConnection *connection;578 575 579 576 // --- get bookmark … … 588 585 [url setPassword:password ? password : @""]; 589 586 590 connection = [[WCServerConnection alloc] initServerConnectionWithURL:url bookmark:bookmark]; 591 [connection connect]; 587 [[WCServerConnection serverConnectionWithURL:url bookmark:bookmark] connect]; 592 588 } 593 589 WiredClient/trunk/WCMessages.m
r3443 r3503 374 374 [[self connection] postNotificationName:WCMessagesDidAddMessage object:[self connection]]; 375 375 376 [[self connection] postNotificationName:WCConnectionTriggeredEvent377 object:[NSNumber numberWithInt:WCEventsMessageReceived]];376 // [[self connection] postNotificationName:WCConnectionTriggeredEvent 377 // object:[NSNumber numberWithInt:WCEventsMessageReceived]]; 378 378 } 379 379 … … 416 416 [[self connection] postNotificationName:WCMessagesDidAddMessage object:[self connection]]; 417 417 418 [[self connection] postNotificationName:WCConnectionTriggeredEvent419 object:[NSNumber numberWithInt:WCEventsBroadcastReceived]];418 // [[self connection] postNotificationName:WCConnectionTriggeredEvent 419 // object:[NSNumber numberWithInt:WCEventsBroadcastReceived]]; 420 420 } 421 421 WiredClient/trunk/WCPublicChat.m
r3414 r3503 288 288 289 289 290 - (void)connection Closed:(NSNotification *)notification {290 - (void)connectionDidClose:(NSNotification *)notification { 291 291 [WCError setWithError:WCApplicationErrorServerDisconnected]; 292 292 [WCError show]; WiredClient/trunk/WCServerConnection.h
r3413 r3503 28 28 29 29 #import "WCConnection.h" 30 31 @protocol WCConnection;32 30 33 31 @class WCServer, WCCache, WCAccount; … … 120 118 121 119 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; 124 122 125 123 - (BOOL)isHidden; WiredClient/trunk/WCServerConnection.m
r3420 r3503 44 44 @interface WCServerConnection(Private) 45 45 46 - (id)_initServerConnectionWithURL:(WIURL *)url bookmark:(NSDictionary *)bookmark; 47 46 48 - (void)_login; 47 49 … … 50 52 51 53 @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 52 116 53 117 - (void)_login { … … 91 155 @implementation WCServerConnection 92 156 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]; 157 165 } 158 166 … … 343 351 344 352 - (void)linkConnected:(WCLink *)link { 345 [self postNotificationName:WCConnection Connectedobject:self];353 [self postNotificationName:WCConnectionDidConnect object:self]; 346 354 347 355 [link sendCommand:WCHelloCommand]; … … 351 359 352 360 - (void)linkClosed:(WCLink *)link { 353 [self postNotificationName:WCConnection Closedobject:self];361 [self postNotificationName:WCConnectionDidClose object:self]; 354 362 } 355 363 … … 538 546 539 547 default: 540 if(message >= 500 && message <= 599)541 name = WCConnectionReceivedError;548 // if(message >= 500 && message <= 599) 549 // name = WCConnectionReceivedError; 542 550 break; 543 551 } WiredClient/trunk/WCTracker.h
r3413 r3503 28 28 29 29 enum WCTrackerType { 30 WCTrackerType Rendezvous,30 WCTrackerTypeBonjour, 31 31 WCTrackerTypeCategory, 32 32 WCTrackerTypeServer, … … 43 43 44 44 45 @interface WCTracker : WIObject <NSCoding>{45 @interface WCTracker : WIObject { 46 46 WCTrackerType _type; 47 47 WCTrackerState _state; 48 NSImage *_icon; 48 49 NSString *_name; 49 50 NSString *_serverDescription; … … 61 62 62 63 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; 64 69 65 - (void)setType:(WCTrackerType)type;66 - (WCTrackerType)type;67 70 - (void)setState:(WCTrackerState)state; 68 71 - (WCTrackerState)state; 69 - (void)setName:(NSString *)name; 72 73 - (WCTrackerType)type; 74 - (NSImage *)icon; 70 75 - (NSString *)name; 71 - ( void)setServerDescription:(NSString *)serverDescription;76 - (NSString *)nameWithNumberOfServers; 72 77 - (NSString *)serverDescription; 73 - (void)setUsers:(unsigned int)users;74 78 - (unsigned int)users; 75 - (void)setSpeed:(unsigned int)speed;76 79 - (unsigned int)speed; 77 - (void)setFiles:(unsigned int)files;78 80 - (unsigned int)files; 79 - (void)setSize:(unsigned long long)size;80 81 - (unsigned long long)size; 81 - (void)setGuest:(BOOL)value;82 82 - (BOOL)guest; 83 - (void)setDownload:(BOOL)value;84 83 - (BOOL)download; 85 - (void)setURL:(WIURL *)url;86 84 - (WIURL *)URL; 87 - (void)setNetService:(NSNetService *)netService;88 85 - (NSNetService *)netService; 89 86 … … 94 91 - (void)sortChildrenUsingSelector:(SEL)selector; 95 92 - (NSArray *)childrenMatchingFilter:(NSString *)filter; 93 94 - (WCTracker *)categoryWithName:(NSString *)name; 95 - (WCTracker *)categoryForPath:(NSString *)path; 96 96 - (unsigned int)numberOfServers; 97 97 WiredClient/trunk/WCTracker.m
r3413 r3503 31 31 @interface WCTracker(Private) 32 32 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 33 47 - (NSComparisonResult)_compareName:(WCTracker *)tracker; 34 48 … … 36 50 37 51 38 @implementation WCTracker 39 40 - (id) initWithType:(WCTrackerType)type {52 @implementation WCTracker(Private) 53 54 - (id)_initWithType:(WCTrackerType)type { 41 55 self = [super init]; 42 56 43 [self setType:type];57 _type = type; 44 58 45 59 if([self type] != WCTrackerTypeServer) … … 51 65 52 66 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]; 55 223 } 56 224 … … 72 240 #pragma mark - 73 241 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 85 252 86 253 87 254 88 255 #pragma mark - 89 90 - (void)setType:(WCTrackerType)value {91 _type = value;92 }93 94 95 256 96 257 - (WCTrackerType)type { … … 100 261 101 262 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; 119 265 } 120 266 … … 127 273 128 274 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]; 134 280 } 135 281 … … 142 288 143 289 144 - (void)setUsers:(unsigned int)users {145 _users = users;146 }147 148 149 150 290 - (unsigned int)users { 151 291 return _users; … … 154 294 155 295 156 - (void)setSpeed:(unsigned int)speed {157 _speed = speed;158 }159 160 161 162 296 - (unsigned int)speed { 163 297 return _speed; … … 166 300 167 301 168 - (void)setFiles:(unsigned int)files {169 _files = files;170 }171 172 173 174 302 - (unsigned int)files { 175 303 return _files; … … 178 306 179 307 180 - (void)setSize:(unsigned long long)size {181 _size = size;182 }183 184 185 186 308 - (unsigned long long)size { 187 309 return _size; … … 190 312 191 313 192 - (void)setGuest:(BOOL)guest {193 _guest = guest;194 }195 196 197 198 314 - (BOOL)guest { 199 315 return _guest; … … 202 318 203 319 204 - (void)setDownload:(BOOL)download {205 _download = download;206 }207 208 209 &nbs
