Index: src/IRCConnection.h ================================================================== --- src/IRCConnection.h +++ src/IRCConnection.h @@ -40,10 +40,13 @@ didSeeUser: (IRCUser*)user joinChannel: (IRCChannel*)channel; - (void)connection: (IRCConnection*)connection didSeeUser: (IRCUser*)user leaveChannel: (IRCChannel*)channel + withReason: (OFString*)reason; +- (void)connection: (IRCConnection*)connection + didSeeUserQuit: (IRCUser*)user withReason: (OFString*)reason; - (void)connection: (IRCConnection*)connection didReceiveMessage: (OFString*)msg fromUser: (IRCUser*)user inChannel: (IRCChannel*)channel; Index: src/IRCConnection.m ================================================================== --- src/IRCConnection.m +++ src/IRCConnection.m @@ -228,10 +228,37 @@ [delegate connection: self didSeeUser: user leaveChannel: channel withReason: reason]; + continue; + } + + /* QUIT */ + if (splitted.count >= 2 && + [[splitted objectAtIndex: 1] isEqual: @"QUIT"]) { + OFString *who = [splitted objectAtIndex: 0]; + IRCUser *user; + OFString *reason = nil; + size_t pos = who.length + 1 + + [[splitted objectAtIndex: 1] length]; + + who = [who substringWithRange: + of_range(1, who.length - 1)]; + + user = [IRCUser IRCUserWithString: who]; + + if (splitted.count > 2) + reason = [line substringWithRange: + of_range(pos + 2, line.length - pos - 2)]; + + if ([delegate respondsToSelector: + @selector(connection:didSeeUserQuit:withReason:)]) + [delegate connection: self + didSeeUserQuit: user + withReason: reason]; + continue; } /* PRIVMSG */ if (splitted.count >= 4 && Index: tests/test.m ================================================================== --- tests/test.m +++ tests/test.m @@ -77,10 +77,17 @@ leaveChannel: (IRCChannel*)channel withReason: (OFString*)reason { of_log(@"%@ left %@ (%@).", user, channel, reason); } + +- (void)connection: (IRCConnection*)connection + didSeeUserQuit: (IRCUser*)user + withReason: (OFString*)reason +{ + of_log(@"%@ quit (%@).", user, reason); +} - (void)connection: (IRCConnection*)connection didReceiveMessage: (OFString*)msg fromUser: (IRCUser*)user inChannel: (IRCChannel*)channel