Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: Chat Core/MVIRCChatConnection.h
- ===================================================================
- --- Chat Core/MVIRCChatConnection.h (revision 4401)
- +++ Chat Core/MVIRCChatConnection.h (working copy)
- @@ -32,6 +32,9 @@
- BOOL _watchCommandSupported;
- BOOL _sendQueueProcessing;
- BOOL _pendingIdentificationAttempt;
- + NSString *_failedNickname;
- + NSInteger _failedNicknameCount;
- + BOOL _nicknameShortened;
- }
- + (NSArray *) defaultServerPorts;
- @end
- Index: Chat Core/MVIRCChatConnection.m
- ===================================================================
- --- Chat Core/MVIRCChatConnection.m (revision 4401)
- +++ Chat Core/MVIRCChatConnection.m (working copy)
- @@ -623,6 +623,10 @@
- if( ! [_chatConnection connectToHost:server onPort:serverPort error:NULL] )
- [self performSelectorOnMainThread:@selector( _didNotConnect ) withObject:nil waitUntilDone:NO];
- else [self _resetSendQueueInterval];
- +
- + _failedNickname = nil;
- + _failedNicknameCount = 0;
- + _nicknameShortened = NO;
- }
- - (oneway void) _ircRunloop {
- @@ -673,6 +677,10 @@
- [self scheduleReconnectAttempt];
- }
- + [_failedNickname release];
- + _failedNicknameCount = 0;
- + _nicknameShortened = NO;
- +
- [super _didDisconnect];
- }
- @@ -2120,10 +2128,20 @@
- NSString *nick = [self nextAlternateNickname];
- if( ! [nick length] && [parameters count] >= 2 ) {
- NSString *lastNickTried = [self _stringFromPossibleData:[parameters objectAtIndex:1]];
- - nick = [lastNickTried stringByAppendingString:@"_"];
- +
- + if( ( _failedNickname && [_failedNickname isCaseInsensitiveEqualToString:lastNickTried] ) || _nicknameShortened) {
- + nick = [[lastNickTried substringToIndex:([lastNickTried length] - 2)] stringByAppendingString:[NSString stringWithFormat:@"_%d", _failedNicknameCount]];
- +
- + _nicknameShortened = YES;
- + } else nick = [lastNickTried stringByAppendingString:@"_"];
- }
- +
- + if ( ! _failedNickname ) _failedNickname = [[self _stringFromPossibleData:[parameters objectAtIndex:1]] copy];
- if( [nick length] ) [self setNickname:nick];
- +
- + if ( _failedNicknameCount < 9 ) _failedNicknameCount++;
- + else _failedNicknameCount = 0;
- } else {
- // "<current nickname> <new nickname> :Cannot change nick"
- // - Sent to a user who is changing their nickname to a nickname someone else is actively using.
Add Comment
Please, Sign In to add comment