Skip to content

Instantly share code, notes, and snippets.

@FurryHead
Created June 28, 2011 20:27
Show Gist options
  • Save FurryHead/1052107 to your computer and use it in GitHub Desktop.
Save FurryHead/1052107 to your computer and use it in GitHub Desktop.
string[3] user;
// this end up in the sequence [0] = nick, [1] = ident, [2] = host
user[0] = split(trim(words[0], ":"), "!")[0];
if (words[0].find("!") != string::npos && words[0].find("@") != string::npos) {
user[1] = split(split(trim(words[0], ":"), "!")[1], "@")[0];
user[2] = split(split(trim(words[0], ":"), "!")[1], "@")[1];
} else {
user[1] = "";
user[2] = "";
}
if (words[1] == "376" || words[1] == "422") {
signedOn();
} else if (words[1] == "PRIVMSG") {
if (words[3][0] == ':')
words[3] = words[3].substr(1);
cout << "<" << (words[2] == config["nick"] ? split(trim(words[0], ":"), "!")[0] : words[2]) << "> " << split(trim(words[0], ":"), "!")[0] << ": " << join(words.begin()+3, words.end(), " ") << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment