Make command parsing case-insensitive.

FossilOrigin-Name: f816d8f084532ca7105c68877af9aa0291d52607f67fdcaae4520cb6309830c8
This commit is contained in:
Jonathan Schleifer 2011-09-09 20:13:59 +00:00
parent f530dc0633
commit d361b27801

View file

@ -145,6 +145,8 @@
OFArray *split; OFArray *split;
for (;;) { for (;;) {
OFString *action = nil;
@try { @try {
line = [sock readLine]; line = [sock readLine];
} @catch (OFInvalidEncodingException *e) { } @catch (OFInvalidEncodingException *e) {
@ -173,9 +175,10 @@
continue; continue;
} }
action = [[split objectAtIndex: 1] uppercaseString];
/* Connected */ /* Connected */
if (split.count >= 4 && if ([action isEqual: @"001"] && split.count >= 4) {
[[split objectAtIndex: 1] isEqual: @"001"]) {
if ([delegate respondsToSelector: if ([delegate respondsToSelector:
@selector(connectionWasEstablished:)]) @selector(connectionWasEstablished:)])
[delegate connectionWasEstablished: self]; [delegate connectionWasEstablished: self];
@ -184,8 +187,7 @@
} }
/* JOIN */ /* JOIN */
if (split.count == 3 && if ([action isEqual: @"JOIN"] && split.count == 3) {
[[split objectAtIndex: 1] isEqual: @"JOIN"]) {
OFString *who = [split objectAtIndex: 0]; OFString *who = [split objectAtIndex: 0];
OFString *where = [split objectAtIndex: 2]; OFString *where = [split objectAtIndex: 2];
IRCUser *user; IRCUser *user;
@ -215,8 +217,7 @@
} }
/* PART */ /* PART */
if (split.count >= 3 && if ([action isEqual: @"part"] && split.count >= 3) {
[[split objectAtIndex: 1] isEqual: @"PART"]) {
OFString *who = [split objectAtIndex: 0]; OFString *who = [split objectAtIndex: 0];
OFString *where = [split objectAtIndex: 2]; OFString *where = [split objectAtIndex: 2];
IRCUser *user; IRCUser *user;
@ -247,8 +248,7 @@
} }
/* QUIT */ /* QUIT */
if (split.count >= 2 && if ([action isEqual: @"QUIT"] && split.count >= 2) {
[[split objectAtIndex: 1] isEqual: @"QUIT"]) {
OFString *who = [split objectAtIndex: 0]; OFString *who = [split objectAtIndex: 0];
IRCUser *user; IRCUser *user;
OFString *reason = nil; OFString *reason = nil;
@ -273,8 +273,7 @@
} }
/* PRIVMSG */ /* PRIVMSG */
if (split.count >= 4 && if ([action isEqual: @"PRIVMSG"] && split.count >= 4) {
[[split objectAtIndex: 1] isEqual: @"PRIVMSG"]) {
OFString *from = [split objectAtIndex: 0]; OFString *from = [split objectAtIndex: 0];
OFString *to = [split objectAtIndex: 2]; OFString *to = [split objectAtIndex: 2];
IRCUser *user; IRCUser *user;