Changeset 3532
- Timestamp:
- 01/04/07 02:57:39 (2 years ago)
- Files:
-
- trunk/Additions/MVUtilities.h (modified) (1 diff)
- trunk/Additions/NSNotificationAdditions.m (modified) (7 diffs)
- trunk/Chat Core/MVIRCChatConnection.m (modified) (63 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Additions/MVUtilities.h
r3531 r3532 28 28 return [[var retain] autorelease]; 29 29 } 30 31 #define MVAssertMainThreadRequired() \ 32 NSAssert1( [NSThread isMainThread], @"Method needs to run on the main thread, not %@.", [NSThread currentThread] ) 33 34 #define MVAssertCorrectThreadRequired(thread) \ 35 NSAssert2( [NSThread currentThread] == (thread), @"Method needs to run on %@, not %@.", (thread), [NSThread currentThread] ) trunk/Additions/NSNotificationAdditions.m
r3420 r3532 1 1 #import "NSNotificationAdditions.h" 2 #import <pthread.h>3 2 4 3 @implementation NSNotificationCenter (NSNotificationCenterAdditions) 5 4 - (void) postNotificationOnMainThread:(NSNotification *) notification { 6 if( pthread_main_np()) return [self postNotification:notification];5 if( [NSThread isMainThread] ) return [self postNotification:notification]; 7 6 [self postNotificationOnMainThread:notification waitUntilDone:NO]; 8 7 } 9 8 10 9 - (void) postNotificationOnMainThread:(NSNotification *) notification waitUntilDone:(BOOL) wait { 11 if( pthread_main_np()) return [self postNotification:notification];10 if( [NSThread isMainThread] ) return [self postNotification:notification]; 12 11 [[self class] performSelectorOnMainThread:@selector( _postNotification: ) withObject:notification waitUntilDone:wait]; 13 12 } … … 18 17 19 18 - (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object { 20 if( pthread_main_np()) return [self postNotificationName:name object:object userInfo:nil];19 if( [NSThread isMainThread] ) return [self postNotificationName:name object:object userInfo:nil]; 21 20 [self postNotificationOnMainThreadWithName:name object:object userInfo:nil waitUntilDone:NO]; 22 21 } 23 22 24 23 - (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo { 25 if( pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];24 if( [NSThread isMainThread] ) return [self postNotificationName:name object:object userInfo:userInfo]; 26 25 [self postNotificationOnMainThreadWithName:name object:object userInfo:userInfo waitUntilDone:NO]; 27 26 } 28 27 29 28 - (void) postNotificationOnMainThreadWithName:(NSString *) name object:(id) object userInfo:(NSDictionary *) userInfo waitUntilDone:(BOOL) wait { 30 if( pthread_main_np()) return [self postNotificationName:name object:object userInfo:userInfo];29 if( [NSThread isMainThread] ) return [self postNotificationName:name object:object userInfo:userInfo]; 31 30 32 31 NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:3]; … … 36 35 37 36 [[self class] performSelectorOnMainThread:@selector( _postNotificationName: ) withObject:info waitUntilDone:wait]; 38 [info release];39 37 } 40 38 … … 45 43 46 44 [[self defaultCenter] postNotificationName:name object:object userInfo:userInfo]; 45 46 [info release]; 47 47 } 48 48 @end … … 50 50 @implementation NSNotificationQueue (NSNotificationQueueAdditions) 51 51 - (void) enqueueNotificationOnMainThread:(NSNotification *) notification postingStyle:(NSPostingStyle) postingStyle { 52 if( pthread_main_np()) return [self enqueueNotification:notification postingStyle:postingStyle coalesceMask:( NSNotificationCoalescingOnName | NSNotificationCoalescingOnSender ) forModes:nil];52 if( [NSThread isMainThread] ) return [self enqueueNotification:notification postingStyle:postingStyle coalesceMask:( NSNotificationCoalescingOnName | NSNotificationCoalescingOnSender ) forModes:nil]; 53 53 [self enqueueNotificationOnMainThread:notification postingStyle:postingStyle coalesceMask:( NSNotificationCoalescingOnName | NSNotificationCoalescingOnSender ) forModes:nil]; 54 54 } 55 55 56 56 - (void) enqueueNotificationOnMainThread:(NSNotification *) notification postingStyle:(NSPostingStyle) postingStyle coalesceMask:(unsigned) coalesceMask forModes:(NSArray *) modes { 57 if( pthread_main_np()) return [self enqueueNotification:notification postingStyle:postingStyle coalesceMask:coalesceMask forModes:modes];57 if( [NSThread isMainThread] ) return [self enqueueNotification:notification postingStyle:postingStyle coalesceMask:coalesceMask forModes:modes]; 58 58 59 59 NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:4]; … … 64 64 65 65 [[self class] performSelectorOnMainThread:@selector( _enqueueNotification: ) withObject:info waitUntilDone:NO]; 66 [info release];67 66 } 68 67 … … 74 73 75 74 [[self defaultQueue] enqueueNotification:notification postingStyle:postingStyle coalesceMask:coalesceMask forModes:modes]; 75 76 [info release]; 76 77 } 77 78 @end trunk/Chat Core/MVIRCChatConnection.m
r3530 r3532 208 208 MVSafeRetainAssign( &_queueWait, [NSDate dateWithTimeIntervalSinceNow:JVQueueWaitBeforeConnected] ); 209 209 210 [self _resetSendQueueInterval];211 210 [self _resetSupportedFeatures]; 212 211 … … 223 222 224 223 - (void) disconnectWithReason:(NSAttributedString *) reason { 225 [self cancelPendingReconnectAttempts]; 224 [self performSelector:@selector( cancelPendingReconnectAttempts ) withObject:nil inThread:[NSThread mainThread]]; 225 226 226 if( _sendQueueProcessing && _connectionThread ) 227 227 [self performSelector:@selector( _stopSendQueue ) withObject:nil inThread:_connectionThread]; … … 494 494 495 495 - (void) setAwayStatusMessage:(NSAttributedString *) message { 496 [_awayMessage release];497 _awayMessage = nil;498 499 496 if( [[message string] length] ) { 500 497 [[self localUser] _setStatus:MVChatUserAwayStatus]; 501 498 502 _awayMessage = [message copyWithZone:nil];499 MVSafeCopyAssign( &_awayMessage, message ); 503 500 504 501 NSData *msg = [[self class] _flattenedIRCDataForMessage:message withEncoding:[self encoding] andChatFormat:[self outgoingChatFormat]]; 505 502 [self sendRawMessageImmediatelyWithComponents:@"AWAY :", msg, nil]; 506 503 } else { 504 MVSafeAssign( &_awayMessage, nil ); 507 505 [[self localUser] _setStatus:MVChatUserAvailableStatus]; 508 506 [self sendRawMessage:@"AWAY" immediately:YES]; … … 519 517 520 518 - (void) _connect { 519 MVAssertCorrectThreadRequired( _connectionThread ); 520 521 521 id old = _chatConnection; 522 522 _chatConnection = [[AsyncSocket allocWithZone:nil] initWithDelegate:self]; … … 527 527 if( ! [_chatConnection connectToHost:[self server] onPort:[self serverPort] error:NULL] ) 528 528 [self _didNotConnect]; 529 else [self _resetSendQueueInterval]; 529 530 } 530 531 … … 574 575 575 576 - (void) _didDisconnect { 577 MVAssertMainThreadRequired(); 578 576 579 if( _status == MVChatConnectionServerDisconnectedStatus ) { 577 580 if( ABS( [_lastConnectAttempt timeIntervalSinceNow] ) > 300. ) … … 586 589 587 590 - (BOOL) socketWillConnect:(AsyncSocket *) sock { 591 MVAssertCorrectThreadRequired( _connectionThread ); 592 588 593 if( [[self proxyServer] length] && [self proxyServerPort] ) { 589 594 if( _proxy == MVChatConnectionHTTPSProxy || _proxy == MVChatConnectionHTTPProxy ) { … … 635 640 636 641 - (void) socket:(AsyncSocket *) sock willDisconnectWithError:(NSError *) error { 642 MVAssertCorrectThreadRequired( _connectionThread ); 637 643 NSLog(@"connection error: %@", error ); 638 644 MVSafeRetainAssign( &_lastError, error ); … … 640 646 641 647 - (void) socketDidDisconnect:(AsyncSocket *) sock { 648 MVAssertCorrectThreadRequired( _connectionThread ); 649 642 650 if( sock != _chatConnection ) return; 643 651 … … 691 699 692 700 - (void) socket:(AsyncSocket *) sock didConnectToHost:(NSString *) host port:(UInt16) port { 701 MVAssertCorrectThreadRequired( _connectionThread ); 702 693 703 [self setNickname:[self preferredNickname]]; 694 704 … … 706 716 707 717 - (void) socket:(AsyncSocket *) sock didReadData:(NSData *) data withTag:(long) tag { 718 MVAssertCorrectThreadRequired( _connectionThread ); 719 708 720 NSString *rawString = [self _newStringWithBytes:[data bytes] length:[data length]]; 709 721 … … 847 859 848 860 - (void) _writeDataToServer:(id) raw { 861 MVAssertCorrectThreadRequired( _connectionThread ); 862 849 863 NSMutableData *data = nil; 850 864 NSString *string = nil; … … 879 893 880 894 - (void) _readNextMessageFromServer { 895 MVAssertCorrectThreadRequired( _connectionThread ); 896 881 897 static NSData *delimiter = nil; 882 898 // IRC messages end in \x0D\x0A, but some non-compliant servers only use \x0A during the connecting phase … … 972 988 973 989 - (void) _periodicEvents { 990 MVAssertCorrectThreadRequired( _connectionThread ); 991 974 992 @synchronized( _knownUsers ) { 975 993 NSMutableArray *removeList = [[NSMutableArray allocWithZone:nil] initWithCapacity:[_knownUsers count]]; … … 998 1016 999 1017 - (void) _pingServer { 1018 MVAssertCorrectThreadRequired( _connectionThread ); 1000 1019 [self sendRawMessageImmediatelyWithFormat:@"PING %@", [self server]]; 1001 1020 [self performSelector:@selector( _pingServer ) withObject:nil afterDelay:JVPingServerInterval]; … … 1003 1022 1004 1023 - (void) _startSendQueue { 1024 MVAssertCorrectThreadRequired( _connectionThread ); 1025 1005 1026 if( _sendQueueProcessing ) return; 1006 1027 _sendQueueProcessing = YES; 1028 1007 1029 if( _queueWait && [_queueWait timeIntervalSinceNow] > 0. ) 1008 1030 [self performSelector:@selector( _sendQueue ) withObject:nil afterDelay:[_queueWait timeIntervalSinceNow]]; … … 1011 1033 1012 1034 - (void) _stopSendQueue { 1035 MVAssertCorrectThreadRequired( _connectionThread ); 1036 [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector( _sendQueue ) object:nil]; 1013 1037 _sendQueueProcessing = NO; 1014 [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector( _sendQueue ) object:nil];1015 1038 } 1016 1039 1017 1040 - (void) _resetSendQueueInterval { 1041 MVAssertCorrectThreadRequired( _connectionThread ); 1042 1018 1043 [self _stopSendQueue]; 1019 1044 @synchronized( _sendQueue ) { … … 1024 1049 1025 1050 - (void) _sendQueue { 1051 MVAssertCorrectThreadRequired( _connectionThread ); 1052 1026 1053 @synchronized( _sendQueue ) { 1027 1054 if( ! [_sendQueue count] ) { … … 1081 1108 1082 1109 - (void) _scheduleWhoisForUser:(MVChatUser *) user { 1110 MVAssertCorrectThreadRequired( _connectionThread ); 1111 1083 1112 if( ! _pendingWhoisUsers ) 1084 1113 _pendingWhoisUsers = [[NSMutableSet allocWithZone:nil] initWithCapacity:50]; … … 1089 1118 1090 1119 - (void) _whoisNextScheduledUser { 1120 MVAssertCorrectThreadRequired( _connectionThread ); 1121 1091 1122 if( [_pendingWhoisUsers count] ) { 1092 1123 MVChatUser *user = [_pendingWhoisUsers anyObject]; … … 1096 1127 1097 1128 - (void) _whoisWatchedUsers { 1129 MVAssertCorrectThreadRequired( _connectionThread ); 1130 1098 1131 [self performSelector:@selector( _whoisWatchedUsers ) withObject:nil afterDelay:JVWatchedUserWHOISDelay]; 1099 1132 … … 1115 1148 1116 1149 - (void) _checkWatchedUsers { 1150 MVAssertCorrectThreadRequired( _connectionThread ); 1151 1117 1152 if( _watchCommandSupported ) return; // we don't need to call this anymore, return before we reschedule 1118 1153 … … 1231 1266 1232 1267 - (void) _handle001WithParameters:(NSArray *) parameters fromSender:(id) sender { 1268 MVAssertCorrectThreadRequired( _connectionThread ); 1269 1233 1270 MVSafeRetainAssign( &_queueWait, [NSDate dateWithTimeIntervalSinceNow:0.5] ); 1234 1271 … … 1255 1292 1256 1293 - (void) _handle005WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_ISUPPORT 1294 MVAssertCorrectThreadRequired( _connectionThread ); 1295 1257 1296 if( ! _serverInformation ) 1258 1297 _serverInformation = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:5]; … … 1379 1418 1380 1419 - (void) _handle433WithParameters:(NSArray *) parameters fromSender:(id) sender { // ERR_NICKNAMEINUSE 1420 MVAssertCorrectThreadRequired( _connectionThread ); 1421 1381 1422 if( ! [self isConnected] ) { 1382 1423 NSString *nick = [self nextAlternateNickname]; … … 1390 1431 1391 1432 - (void) _handlePrivmsgWithParameters:(NSArray *) parameters fromSender:(MVChatUser *) sender { 1433 MVAssertCorrectThreadRequired( _connectionThread ); 1434 1392 1435 // if the sender is a server lets make a user for the server name 1393 1436 // this is not ideal but the notifications need user objects … … 1428 1471 1429 1472 - (void) _handleNoticeWithParameters:(NSArray *) parameters fromSender:(MVChatUser *) sender { 1473 MVAssertCorrectThreadRequired( _connectionThread ); 1474 1430 1475 // if the sender is a server lets make a user for the server name 1431 1476 // this is not ideal but the notifications need user objects … … 1480 1525 1481 1526 - (void) _handleCTCP:(NSDictionary *) ctcpInfo { 1527 MVAssertMainThreadRequired(); 1528 1482 1529 BOOL request = [[ctcpInfo objectForKey:@"request"] boolValue]; 1483 1530 NSData *data = [ctcpInfo objectForKey:@"data"]; … … 1773 1820 1774 1821 - (void) _handleCTCP:(NSMutableData *) data asRequest:(BOOL) request fromSender:(MVChatUser *) sender forRoom:(MVChatRoom *) room { 1822 MVAssertCorrectThreadRequired( _connectionThread ); 1823 1775 1824 NSMutableDictionary *info = [[NSMutableDictionary allocWithZone:nil] initWithCapacity:4]; 1776 1825 if( data ) [info setObject:data forKey:@"data"]; … … 1786 1835 1787 1836 - (void) _handleJoinWithParameters:(NSArray *) parameters fromSender:(MVChatUser *) sender { 1837 MVAssertCorrectThreadRequired( _connectionThread ); 1838 1788 1839 if( [parameters count] && [sender isKindOfClass:[MVChatUser class]] ) { 1789 1840 NSString *name = [self _stringFromPossibleData:[parameters objectAtIndex:0]]; … … 1810 1861 1811 1862 - (void) _handlePartWithParameters:(NSArray *) parameters fromSender:(MVChatUser *) sender { 1863 MVAssertCorrectThreadRequired( _connectionThread ); 1864 1812 1865 if( [parameters count] >= 1 && [sender isKindOfClass:[MVChatUser class]] ) { 1813 1866 NSString *roomName = [self _stringFromPossibleData:[parameters objectAtIndex:0]]; … … 1827 1880 1828 1881 - (void) _handleQuitWithParameters:(NSArray *) parameters fromSender:(MVChatUser *) sender { 1882 MVAssertCorrectThreadRequired( _connectionThread ); 1883 1829 1884 if( [parameters count] && [sender isKindOfClass:[MVChatUser class]] ) { 1830 1885 if( [sender isLocalUser] ) return; … … 1850 1905 1851 1906 - (void) _handleKickWithParameters:(NSArray *) parameters fromSender:(MVChatUser *) sender { 1907 MVAssertCorrectThreadRequired( _connectionThread ); 1908 1852 1909 // if the sender is a server lets make a user for the server name 1853 1910 // this is not ideal but the notifications need user objects … … 1873 1930 1874 1931 - (void) _handleTopicWithParameters:(NSArray *) parameters fromSender:(MVChatUser *) sender { 1932 MVAssertCorrectThreadRequired( _connectionThread ); 1933 1875 1934 // if the sender is a server lets make a user for the server name 1876 1935 // this is not ideal but the notifications need user objects … … 2017 2076 2018 2077 - (void) _handleModeWithParameters:(NSArray *) parameters fromSender:(MVChatUser *) sender { 2078 MVAssertCorrectThreadRequired( _connectionThread ); 2079 2019 2080 // if the sender is a server lets make a user for the server name 2020 2081 // this is not ideal but the notifications need user objects … … 2034 2095 2035 2096 - (void) _handle324WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_CHANNELMODEIS 2097 MVAssertCorrectThreadRequired( _connectionThread ); 2098 2036 2099 if( [parameters count] >= 3 ) { 2037 2100 MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:1]]; … … 2044 2107 2045 2108 - (void) _handlePingWithParameters:(NSArray *) parameters fromSender:(id) sender { 2109 MVAssertCorrectThreadRequired( _connectionThread ); 2110 2046 2111 if( [parameters count] >= 1 ) { 2047 2112 if( [parameters count] == 1 ) … … 2055 2120 2056 2121 - (void) _handleInviteWithParameters:(NSArray *) parameters fromSender:(MVChatUser *) sender { 2122 MVAssertCorrectThreadRequired( _connectionThread ); 2123 2057 2124 // if the sender is a server lets make a user for the server name 2058 2125 // this is not ideal but the notifications need user objects … … 2068 2135 2069 2136 - (void) _handleNickWithParameters:(NSArray *) parameters fromSender:(MVChatUser *) sender { 2137 MVAssertCorrectThreadRequired( _connectionThread ); 2138 2070 2139 if( [parameters count] == 1 && [sender isKindOfClass:[MVChatUser class]] ) { 2071 2140 NSString *nick = [self _stringFromPossibleData:[parameters objectAtIndex:0]]; … … 2103 2172 2104 2173 - (void) _handle303WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_ISON 2174 MVAssertCorrectThreadRequired( _connectionThread ); 2175 2105 2176 if( [parameters count] == 2 && _isonSentCount > 0 ) { 2106 2177 _isonSentCount--; … … 2157 2228 2158 2229 - (void) _handle301WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_AWAY 2230 MVAssertCorrectThreadRequired( _connectionThread ); 2231 2159 2232 if( [parameters count] == 3 ) { 2160 2233 MVChatUser *user = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:1]]; … … 2168 2241 2169 2242 - (void) _handle305WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_UNAWAY 2243 MVAssertCorrectThreadRequired( _connectionThread ); 2170 2244 [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatConnectionSelfAwayStatusChangedNotification object:self userInfo:nil]; 2171 2245 } 2172 2246 2173 2247 - (void) _handle306WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_NOWAWAY 2248 MVAssertCorrectThreadRequired( _connectionThread ); 2174 2249 [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatConnectionSelfAwayStatusChangedNotification object:self userInfo:nil]; 2175 2250 } … … 2179 2254 2180 2255 - (void) _handle353WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_NAMREPLY 2256 MVAssertCorrectThreadRequired( _connectionThread ); 2257 2181 2258 if( [parameters count] == 4 ) { 2182 2259 MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:2]]; … … 2223 2300 2224 2301 - (void) _handle366WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_ENDOFNAMES 2302 MVAssertCorrectThreadRequired( _connectionThread ); 2303 2225 2304 if( [parameters count] >= 2 ) { 2226 2305 MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:1]]; … … 2243 2322 2244 2323 - (void) _handle352WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_WHOREPLY 2324 MVAssertCorrectThreadRequired( _connectionThread ); 2325 2245 2326 if( [parameters count] >= 7 ) { 2246 2327 MVChatUser *member = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:5]]; … … 2274 2355 2275 2356 - (void) _handle315WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_ENDOFWHO 2357 MVAssertCorrectThreadRequired( _connectionThread ); 2358 2276 2359 if( [parameters count] >= 2 ) { 2277 2360 MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:1]]; … … 2284 2367 2285 2368 - (void) _handle322WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_LIST 2369 MVAssertCorrectThreadRequired( _connectionThread ); 2370 2286 2371 if( [parameters count] == 4 ) { 2287 2372 NSString *room = [parameters objectAtIndex:1]; … … 2300 2385 2301 2386 - (void) _handle367WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_BANLIST 2387 MVAssertCorrectThreadRequired( _connectionThread ); 2388 2302 2389 if( [parameters count] >= 3 ) { 2303 2390 MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:1]]; … … 2320 2407 2321 2408 - (void) _handle368WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_ENDOFBANLIST 2409 MVAssertCorrectThreadRequired( _connectionThread ); 2410 2322 2411 if( [parameters count] >= 2 ) { 2323 2412 MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:1]]; … … 2331 2420 2332 2421 - (void) _handle332WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_TOPIC 2422 MVAssertCorrectThreadRequired( _connectionThread ); 2423 2333 2424 if( [parameters count] == 3 ) { 2334 2425 MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:1]]; … … 2338 2429 2339 2430 - (void) _handle333WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_TOPICWHOTIME_IRCU 2431 MVAssertCorrectThreadRequired( _connectionThread ); 2432 2340 2433 if( [parameters count] >= 4 ) { 2341 2434 MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:1]]; … … 2352 2445 2353 2446 - (void) _handle311WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_WHOISUSER 2447 MVAssertCorrectThreadRequired( _connectionThread ); 2448 2354 2449 if( [parameters count] == 6 ) { 2355 2450 NSString *nick = [parameters objectAtIndex:1]; … … 2369 2464 2370 2465 - (void) _handle312WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_WHOISSERVER 2466 MVAssertCorrectThreadRequired( _connectionThread ); 2467 2371 2468 if( [parameters count] >= 3 ) { 2372 2469 MVChatUser *user = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:1]]; … … 2376 2473 2377 2474 - (void) _handle313WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_WHOISOPERATOR 2475 MVAssertCorrectThreadRequired( _connectionThread ); 2476 2378 2477 if( [parameters count] >= 2 ) { 2379 2478 MVChatUser *user = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:1]]; … … 2383 2482 2384 2483 - (void) _handle317WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_WHOISIDLE 2484 MVAssertCorrectThreadRequired( _connectionThread ); 2485 2385 2486 if( [parameters count] >= 3 ) { 2386 2487 MVChatUser *user = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:1]]; … … 2399 2500 2400 2501 - (void) _handle318WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_ENDOFWHOIS 2502 MVAssertCorrectThreadRequired( _connectionThread ); 2503 2401 2504 if( [parameters count] >= 2 ) { 2402 2505 MVChatUser *user = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:1]]; … … 2413 2516 2414 2517 - (void) _handle319WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_WHOISCHANNELS 2518 MVAssertCorrectThreadRequired( _connectionThread ); 2519 2415 2520 if( [parameters count] == 3 ) { 2416 2521 NSString *rooms = [self _stringFromPossibleData:[parameters objectAtIndex:2]]; … … 2443 2548 2444 2549 - (void) _handle320WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_WHOISIDENTIFIED 2550 MVAssertCorrectThreadRequired( _connectionThread ); 2551 2445 2552 if( [parameters count] == 3 ) { 2446 2553 NSString *comment = [self _stringFromPossibleData:[parameters objectAtIndex:2]]; … … 2456 2563 2457 2564 - (void) _handle401WithParameters:(NSArray *) parameters fromSender:(id) sender { // ERR_NOSUCHNICK 2565 MVAssertCorrectThreadRequired( _connectionThread ); 2566 2458 2567 if( [parameters count] >= 2 ) { 2459 2568 MVChatUser *user = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:1]]; … … 2467 2576 2468 2577 - (void) _handle402WithParameters:(NSArray *) parameters fromSender:(id) sender { // ERR_NOSUCHSERVER 2578 MVAssertCorrectThreadRequired( _connectionThread ); 2579 2469 2580 // some servers send back 402 (No such server) when we send our double nickname WHOIS requests, treat as a user 2470 2581 if( [parameters count] >= 2 ) { … … 2479 2590 2480 2591 - (void) _handle421WithParameters:(NSArray *) parameters fromSender:(id) sender { // ERR_UNKNOWNCOMMAND 2592 MVAssertCorrectThreadRequired( _connectionThread ); 2593 2481 2594 if( [parameters count] >= 2 ) { 2482 2595 NSString *command = [parameters objectAtIndex:1]; … … 2494 2607 2495 2608 - (void) _handle604WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_NOWON_BAHAMUT_UNREAL 2609 MVAssertCorrectThreadRequired( _connectionThread ); 2610 2496 2611 if( [parameters count] >= 5 ) { 2497 2612 MVChatUser *user = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:1]]; … … 2507 2622 2508 2623 - (void) _handle600WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_LOGON_BAHAMUT_UNREAL 2509 if( [parameters count] >= 5 ) { 2624 MVAssertCorrectThreadRequired( _connectionThread ); 2625 2626 if( [parameters count] >= 5 ) 2510 2627 [self _handle604WithParameters:parameters fromSender:sender]; // do everything we do above 2511 }2512 2628 } 2513 2629 @end
