Index: src/IRCConnection.h ================================================================== --- src/IRCConnection.h +++ src/IRCConnection.h @@ -103,7 +103,8 @@ - (void)sendNotice: (OFString*)notice toChannel: (IRCChannel*)channel; - (void)kickUser: (IRCUser*)user fromChannel: (IRCChannel*)channel withReason: (OFString*)reason; +- (void)changeNicknameTo: (OFString*)nickname; - (void)handleConnection; @end Index: src/IRCConnection.m ================================================================== --- src/IRCConnection.m +++ src/IRCConnection.m @@ -155,10 +155,15 @@ withReason: (OFString*)reason { [self sendLineWithFormat: @"KICK %@ %@ :%@", channel.name, user.nickname, reason]; } + +- (void)changeNicknameTo: (OFString*)nickname_ +{ + [self sendLineWithFormat: @"NICK %@", nickname_]; +} - (void)handleConnection { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *line; @@ -335,10 +340,15 @@ of_range(1, who.length - 1)]; newNickname = [newNickname substringWithRange: of_range(1, newNickname.length - 1)]; user = [IRCUser IRCUserWithString: who]; + + if ([user.nickname isEqual: nickname]) { + [nickname release]; + nickname = [user.nickname copy]; + } if ([delegate respondsToSelector: @selector(connection:didSeeUser:changeNicknameTo:)]) [delegate connection: self didSeeUser: user