Rename splitted to split.
FossilOrigin-Name: 5e1d907b6ce138715487e34a8e3865bb7f73b3197d4568c21c2775c77f576e1b
This commit is contained in:
parent
8bef7c2e26
commit
5e4747ea9c
1 changed files with 25 additions and 27 deletions
|
@ -130,7 +130,7 @@
|
||||||
{
|
{
|
||||||
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
||||||
OFString *line;
|
OFString *line;
|
||||||
OFArray *splitted;
|
OFArray *split;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@try {
|
@try {
|
||||||
|
@ -149,11 +149,10 @@
|
||||||
[delegate connection: self
|
[delegate connection: self
|
||||||
didReceiveLine: line];
|
didReceiveLine: line];
|
||||||
|
|
||||||
splitted = [line componentsSeparatedByString: @" "];
|
split = [line componentsSeparatedByString: @" "];
|
||||||
|
|
||||||
/* PING */
|
/* PING */
|
||||||
if (splitted.count == 2 &&
|
if (split.count == 2 && [split.firstObject isEqual: @"PING"]) {
|
||||||
[splitted.firstObject isEqual: @"PING"]) {
|
|
||||||
OFMutableString *s = [[line mutableCopy] autorelease];
|
OFMutableString *s = [[line mutableCopy] autorelease];
|
||||||
[s replaceOccurrencesOfString: @"PING"
|
[s replaceOccurrencesOfString: @"PING"
|
||||||
withString: @"PONG"];
|
withString: @"PONG"];
|
||||||
|
@ -163,8 +162,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Connected */
|
/* Connected */
|
||||||
if (splitted.count >= 4 &&
|
if (split.count >= 4 &&
|
||||||
[[splitted objectAtIndex: 1] isEqual: @"001"]) {
|
[[split objectAtIndex: 1] isEqual: @"001"]) {
|
||||||
if ([delegate respondsToSelector:
|
if ([delegate respondsToSelector:
|
||||||
@selector(connectionWasEstablished:)])
|
@selector(connectionWasEstablished:)])
|
||||||
[delegate connectionWasEstablished: self];
|
[delegate connectionWasEstablished: self];
|
||||||
|
@ -173,10 +172,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* JOIN */
|
/* JOIN */
|
||||||
if (splitted.count == 3 &&
|
if (split.count == 3 &&
|
||||||
[[splitted objectAtIndex: 1] isEqual: @"JOIN"]) {
|
[[split objectAtIndex: 1] isEqual: @"JOIN"]) {
|
||||||
OFString *who = [splitted objectAtIndex: 0];
|
OFString *who = [split objectAtIndex: 0];
|
||||||
OFString *where = [splitted objectAtIndex: 2];
|
OFString *where = [split objectAtIndex: 2];
|
||||||
IRCUser *user;
|
IRCUser *user;
|
||||||
IRCChannel *channel;
|
IRCChannel *channel;
|
||||||
|
|
||||||
|
@ -202,15 +201,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PART */
|
/* PART */
|
||||||
if (splitted.count >= 3 &&
|
if (split.count >= 3 &&
|
||||||
[[splitted objectAtIndex: 1] isEqual: @"PART"]) {
|
[[split objectAtIndex: 1] isEqual: @"PART"]) {
|
||||||
OFString *who = [splitted objectAtIndex: 0];
|
OFString *who = [split objectAtIndex: 0];
|
||||||
OFString *where = [splitted objectAtIndex: 2];
|
OFString *where = [split objectAtIndex: 2];
|
||||||
IRCUser *user;
|
IRCUser *user;
|
||||||
IRCChannel *channel;
|
IRCChannel *channel;
|
||||||
OFString *reason = nil;
|
OFString *reason = nil;
|
||||||
size_t pos = who.length + 1 +
|
size_t pos = who.length + 1 +
|
||||||
[[splitted objectAtIndex: 1] length] + 1 +
|
[[split objectAtIndex: 1] length] + 1 +
|
||||||
where.length;
|
where.length;
|
||||||
|
|
||||||
who = [who substringWithRange:
|
who = [who substringWithRange:
|
||||||
|
@ -218,7 +217,7 @@
|
||||||
user = [IRCUser IRCUserWithString: who];
|
user = [IRCUser IRCUserWithString: who];
|
||||||
channel = [channels objectForKey: where];
|
channel = [channels objectForKey: where];
|
||||||
|
|
||||||
if (splitted.count > 3)
|
if (split.count > 3)
|
||||||
reason = [line substringWithRange:
|
reason = [line substringWithRange:
|
||||||
of_range(pos + 2, line.length - pos - 2)];
|
of_range(pos + 2, line.length - pos - 2)];
|
||||||
|
|
||||||
|
@ -234,20 +233,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* QUIT */
|
/* QUIT */
|
||||||
if (splitted.count >= 2 &&
|
if (split.count >= 2 &&
|
||||||
[[splitted objectAtIndex: 1] isEqual: @"QUIT"]) {
|
[[split objectAtIndex: 1] isEqual: @"QUIT"]) {
|
||||||
OFString *who = [splitted objectAtIndex: 0];
|
OFString *who = [split objectAtIndex: 0];
|
||||||
IRCUser *user;
|
IRCUser *user;
|
||||||
OFString *reason = nil;
|
OFString *reason = nil;
|
||||||
size_t pos = who.length + 1 +
|
size_t pos = who.length + 1 +
|
||||||
[[splitted objectAtIndex: 1] length];
|
[[split objectAtIndex: 1] length];
|
||||||
|
|
||||||
who = [who substringWithRange:
|
who = [who substringWithRange:
|
||||||
of_range(1, who.length - 1)];
|
of_range(1, who.length - 1)];
|
||||||
|
|
||||||
user = [IRCUser IRCUserWithString: who];
|
user = [IRCUser IRCUserWithString: who];
|
||||||
|
|
||||||
if (splitted.count > 2)
|
if (split.count > 2)
|
||||||
reason = [line substringWithRange:
|
reason = [line substringWithRange:
|
||||||
of_range(pos + 2, line.length - pos - 2)];
|
of_range(pos + 2, line.length - pos - 2)];
|
||||||
|
|
||||||
|
@ -261,14 +259,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PRIVMSG */
|
/* PRIVMSG */
|
||||||
if (splitted.count >= 4 &&
|
if (split.count >= 4 &&
|
||||||
[[splitted objectAtIndex: 1] isEqual: @"PRIVMSG"]) {
|
[[split objectAtIndex: 1] isEqual: @"PRIVMSG"]) {
|
||||||
OFString *from = [splitted objectAtIndex: 0];
|
OFString *from = [split objectAtIndex: 0];
|
||||||
OFString *to = [splitted objectAtIndex: 2];
|
OFString *to = [split objectAtIndex: 2];
|
||||||
IRCUser *user;
|
IRCUser *user;
|
||||||
OFString *msg;
|
OFString *msg;
|
||||||
size_t pos = from.length + 1 +
|
size_t pos = from.length + 1 +
|
||||||
[[splitted objectAtIndex: 1] length] + 1 +
|
[[split objectAtIndex: 1] length] + 1 +
|
||||||
to.length;
|
to.length;
|
||||||
|
|
||||||
from = [from substringWithRange:
|
from = [from substringWithRange:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue