Index: src/IRCConnection.h ================================================================== --- src/IRCConnection.h +++ src/IRCConnection.h @@ -42,10 +42,13 @@ - (void)connection: (IRCConnection*)connection didSeeUser: (IRCUser*)user leaveChannel: (IRCChannel*)channel withReason: (OFString*)reason; - (void)connection: (IRCConnection*)connection + didSeeUser: (IRCUser*)user + changeNicknameTo: (OFString*)nickname; +- (void)connection: (IRCConnection*)connection didSeeUserQuit: (IRCUser*)user withReason: (OFString*)reason; - (void)connection: (IRCConnection*)connection didReceiveMessage: (OFString*)msg fromUser: (IRCUser*)user Index: src/IRCConnection.m ================================================================== --- src/IRCConnection.m +++ src/IRCConnection.m @@ -269,10 +269,30 @@ didSeeUserQuit: user withReason: reason]; continue; } + + /* NICK */ + if ([action isEqual: @"NICK"] && split.count == 3) { + OFString *who = [split objectAtIndex: 0]; + OFString *newNickname = [split objectAtIndex: 2]; + IRCUser *user; + + who = [who substringWithRange: + of_range(1, who.length - 1)]; + newNickname = [newNickname substringWithRange: + of_range(1, newNickname.length - 1)]; + + user = [IRCUser IRCUserWithString: who]; + + if ([delegate respondsToSelector: + @selector(connection:didSeeUser:changeNicknameTo:)]) + [delegate connection: self + didSeeUser: user + changeNicknameTo: newNickname]; + } /* PRIVMSG */ if ([action isEqual: @"PRIVMSG"] && split.count >= 4) { OFString *from = [split objectAtIndex: 0]; OFString *to = [split objectAtIndex: 2]; Index: tests/test.m ================================================================== --- tests/test.m +++ tests/test.m @@ -84,10 +84,17 @@ didSeeUserQuit: (IRCUser*)user withReason: (OFString*)reason { of_log(@"%@ quit (%@).", user, reason); } + +- (void)connection: (IRCConnection*)connection + didSeeUser: (IRCUser*)user + changeNicknameTo: (OFString *)nickname +{ + of_log(@"%@ changed nick to %@.", user, nickname); +} - (void)connection: (IRCConnection*)connection didReceiveMessage: (OFString*)msg fromUser: (IRCUser*)user inChannel: (IRCChannel*)channel