diff --git a/src/IRCConnection.h b/src/IRCConnection.h index c7c250c..484a550 100644 --- a/src/IRCConnection.h +++ b/src/IRCConnection.h @@ -105,5 +105,6 @@ - (void)kickUser: (IRCUser*)user fromChannel: (IRCChannel*)channel withReason: (OFString*)reason; +- (void)changeNicknameTo: (OFString*)nickname; - (void)handleConnection; @end diff --git a/src/IRCConnection.m b/src/IRCConnection.m index afb597b..f5ff611 100644 --- a/src/IRCConnection.m +++ b/src/IRCConnection.m @@ -158,6 +158,11 @@ channel.name, user.nickname, reason]; } +- (void)changeNicknameTo: (OFString*)nickname_ +{ + [self sendLineWithFormat: @"NICK %@", nickname_]; +} + - (void)handleConnection { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; @@ -338,6 +343,11 @@ 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