Add support for changing the nickname.

FossilOrigin-Name: 117cdc960f27ad17952e6c2c618b7714d82216717aa623b81a7bb24a6f5ab658
This commit is contained in:
Jonathan Schleifer 2011-09-10 23:21:03 +00:00
parent 50a00bbe98
commit 140c06fd5e
2 changed files with 11 additions and 0 deletions

View file

@ -105,5 +105,6 @@
- (void)kickUser: (IRCUser*)user - (void)kickUser: (IRCUser*)user
fromChannel: (IRCChannel*)channel fromChannel: (IRCChannel*)channel
withReason: (OFString*)reason; withReason: (OFString*)reason;
- (void)changeNicknameTo: (OFString*)nickname;
- (void)handleConnection; - (void)handleConnection;
@end @end

View file

@ -158,6 +158,11 @@
channel.name, user.nickname, reason]; channel.name, user.nickname, reason];
} }
- (void)changeNicknameTo: (OFString*)nickname_
{
[self sendLineWithFormat: @"NICK %@", nickname_];
}
- (void)handleConnection - (void)handleConnection
{ {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
@ -338,6 +343,11 @@
user = [IRCUser IRCUserWithString: who]; user = [IRCUser IRCUserWithString: who];
if ([user.nickname isEqual: nickname]) {
[nickname release];
nickname = [user.nickname copy];
}
if ([delegate respondsToSelector: if ([delegate respondsToSelector:
@selector(connection:didSeeUser:changeNicknameTo:)]) @selector(connection:didSeeUser:changeNicknameTo:)])
[delegate connection: self [delegate connection: self