Mercurial > cabal
diff sources/parser.cpp @ 6:9be05a31b7f9
Enqlave IRC Network => Vaygr IRC Network
-Os optimizations by default
temporary functions' arguments rename
*char => NULL
bool => true|false
renamed some global vars, removed debug info
| author | Vlad Glagolev <enqlave@gmail.com> |
|---|---|
| date | Sun, 27 Jan 2008 17:23:14 +0300 |
| parents | a7051ac7118b |
| children | 8d54d9fdeca3 |
line wrap: on
line diff
--- a/sources/parser.cpp Thu Jan 24 21:00:52 2008 +0300 +++ b/sources/parser.cpp Sun Jan 27 17:23:14 2008 +0300 @@ -34,56 +34,45 @@ char *who = strtok(line, " "); char *what = strtok(NULL, " "); char *where = strtok(NULL, " "); - char *message = strtok(NULL, "\n"); + char *data = strtok(NULL, "\n"); if (strchr(who, '!')) { - alienID = strchr(who, '!'); - alienID = alienID.substr(1); + id = strchr(who, '!'); + id = id.substr(1); } if (strtok(who, "!")) - alien = strtok(who, "!"); + name = strtok(who, "!"); - alienAction = what; + action = what; if (*where == ':') - alienLocation = ++where; + place = ++where; else { - alienLocation = where; + place = where; - if (message) { - if (alienLocation == S->nick) - alienLocation = alien; + if (data) { + if (place == S->nick) + place = name; - alienMessage = (*message == ':') ? ++message: message; + message = (*data == ':') ? ++data: data; - if (*message == CABAL->commander && ++message) { - if (strchr(message, ' ')) { - alienCommand = strtok(message, " "); - alienMessage = strtok(NULL, "\n"); + if (*data == CABAL->commander && ++data) { + if (strchr(data, ' ')) { + command = strtok(data, " "); + message = strtok(NULL, "\n"); } else - alienCommand = message; + command = data; } } } delete[] line; - -/* DEBUG - cout - << "-----------------------------------\n" \ - << "Alien: \t" << alien << endl \ - << "Alien ID:\t" << alienID << endl \ - << "Alien action:\t" << alienAction << endl \ - << "Alien location:\t" << alienLocation << endl \ - << "Alien command:\t" << alienCommand << endl \ - << "Alien message:\t" << alienMessage << endl \ - << "-----------------------------------\n"; -*/ } + } } void Parser::Parse(Connection *S) { - if (alienCommand == "die" && alienID == "stealth@ru.raver") + if (command == "die" && id == "stealth@ru.raver") shut("Requested shutdown"); }
