-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Михајло Анђелковић:
I was returning the server whatever it was sending to me as a ping. This is how it worked like two years ago. Has something changed?
This is the correct way to do it, but many IRC client implementations are lazy and are written by people who guess the protocol, and end up with an incomplete understanding, or simple don't care enough to implement it correctly since the incorrect solution works in most cases.
(As someone else pointed out, many IRC servers (especially hybrid-derived ones) use a "ping cookie" on connect; it was originally intended to defeat source address spoofing, but more recently has been used against other attacks. If you don't reply correctly to a ping from one of these servers, you won't be able to connect.)
- river.
PS: I cringe every time I see someone "parsing" IRC lines with things like strncmp(line, "PRIVMSG ", 8) or strstr(line, " :"). The IRC protocol is very simple, and tokenising it properly is really not that difficult. (Every argument is separated by a space; if the first byte of the argument is ":", remove it and stop splitting.)