Add support for parsing KICK.
FossilOrigin-Name: 6f062f71896107c8ddd1d66fd649f6e7d15e0b6704072eb28bc9ba00582bd4e8
This commit is contained in:
parent
c4da72d924
commit
b0ef070c32
3 changed files with 47 additions and 0 deletions
|
@ -46,6 +46,11 @@
|
||||||
- (void)connection: (IRCConnection*)connection
|
- (void)connection: (IRCConnection*)connection
|
||||||
didSeeUser: (IRCUser*)user
|
didSeeUser: (IRCUser*)user
|
||||||
changeNicknameTo: (OFString*)nickname;
|
changeNicknameTo: (OFString*)nickname;
|
||||||
|
- (void)connection: (IRCConnection*)connection
|
||||||
|
didSeeUser: (IRCUser*)user
|
||||||
|
kickUser: (OFString*)kickedUser
|
||||||
|
fromChannel: (IRCChannel*)channel
|
||||||
|
withReason: (OFString*)reason;
|
||||||
- (void)connection: (IRCConnection*)connection
|
- (void)connection: (IRCConnection*)connection
|
||||||
didSeeUserQuit: (IRCUser*)user
|
didSeeUserQuit: (IRCUser*)user
|
||||||
withReason: (OFString*)reason;
|
withReason: (OFString*)reason;
|
||||||
|
|
|
@ -247,6 +247,39 @@
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* KICK */
|
||||||
|
if ([action isEqual: @"KICK"] && split.count >= 4) {
|
||||||
|
OFString *who = [split objectAtIndex: 0];
|
||||||
|
OFString *where = [split objectAtIndex: 2];
|
||||||
|
OFString *whom = [split objectAtIndex: 3];
|
||||||
|
IRCUser *user;
|
||||||
|
IRCChannel *channel;
|
||||||
|
OFString *reason = nil;
|
||||||
|
size_t pos = who.length + 1 +
|
||||||
|
[[split objectAtIndex: 1] length] + 1 +
|
||||||
|
where.length + 1 + whom.length;
|
||||||
|
|
||||||
|
who = [who substringWithRange:
|
||||||
|
of_range(1, who.length - 1)];
|
||||||
|
user = [IRCUser IRCUserWithString: who];
|
||||||
|
channel = [channels objectForKey: where];
|
||||||
|
|
||||||
|
if (split.count > 4)
|
||||||
|
reason = [line substringWithRange:
|
||||||
|
of_range(pos + 2, line.length - pos - 2)];
|
||||||
|
|
||||||
|
if ([delegate respondsToSelector:
|
||||||
|
@selector(connection:didSeeUser:kickUser:
|
||||||
|
fromChannel:withReason:)])
|
||||||
|
[delegate connection: self
|
||||||
|
didSeeUser: user
|
||||||
|
kickUser: whom
|
||||||
|
fromChannel: channel
|
||||||
|
withReason: reason];
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* QUIT */
|
/* QUIT */
|
||||||
if ([action isEqual: @"QUIT"] && split.count >= 2) {
|
if ([action isEqual: @"QUIT"] && split.count >= 2) {
|
||||||
OFString *who = [split objectAtIndex: 0];
|
OFString *who = [split objectAtIndex: 0];
|
||||||
|
|
|
@ -80,6 +80,15 @@ OF_APPLICATION_DELEGATE(TestApp)
|
||||||
of_log(@"%@ left %@ (%@).", user, channel, reason);
|
of_log(@"%@ left %@ (%@).", user, channel, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)connection: (IRCConnection*)connection
|
||||||
|
didSeeUser: (IRCUser*)user
|
||||||
|
kickUser: (OFString*)kickedUser
|
||||||
|
fromChannel: (IRCChannel*)channel
|
||||||
|
withReason: (OFString*)reason
|
||||||
|
{
|
||||||
|
of_log(@"%@ kicked %@ from %@: %@", user, kickedUser, channel, reason);
|
||||||
|
}
|
||||||
|
|
||||||
- (void)connection: (IRCConnection*)connection
|
- (void)connection: (IRCConnection*)connection
|
||||||
didSeeUserQuit: (IRCUser*)user
|
didSeeUserQuit: (IRCUser*)user
|
||||||
withReason: (OFString*)reason
|
withReason: (OFString*)reason
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue